Menu

Node.js Setup for Creating a Message Queue and Publishing Game Cleanup Tasks
📰

Node.js Setup for Creating a Message Queue and Publishing Game Cleanup Tasks

DEV Community: node·YatesHolloway6872·about 21 hours ago
#NizyzBYt
Reading 0:00
15s threshold

A game session cleanup job should leave the web request quickly, then make its delivery contract explicit. For expired sessions, I would publish one idempotent message per cleanup unit, let a worker claim it, and delete the message only after the write succeeds. The important choice is not the queue brand. It is what happens when a worker dies after claiming work.

The practical rule is this: use at-least-once delivery, make the handler safe to repeat, and set the visibility window longer than the normal cleanup attempt. A queue is a delivery mechanism, not a transaction around every database and game-service write.

That boundary matters.

Suppose the API receives a request to end a match. It records the match as finished and enqueues cleanup for abandoned room membership, temporary inventory reservations, and the session presence record. The request returns after the durable handoff, not after every cleanup operation.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.