Roblox GuidebookKnowledge base
English ⌄

Development / ROBLOX

Why Roblox MemoryStoreQueue delivers a task again

Separate reading, temporary invisibility and acknowledgment so a retry does not apply the outcome twice.

Updated:

Set a lifetime for the task #

Pick a temporary job, such as refreshing a room list on another server. Decide when that job becomes obsolete. MemoryStoreQueue helps with short-lived coordination; keep progress you must recover in an appropriate persistent store. Decide which result your worker needs to record before it acknowledges delivery.

Distinguish reading from acknowledgment #

ReadAsync returns item values and a read identifier. Reading makes those items invisible for a period; it does not remove them. Pass the read identifier to RemoveAsync after processing succeeds. If the invisibility period expires first, an item can be read again provided its expiration time has not elapsed.

Reproduce a second delivery in isolation #

In a test game, enqueue a single short-lived task with your own task ID. Have the first worker read it and intentionally stop before acknowledging it in the test. After invisibility ends, another worker can receive that task ID in the payload. A task ID and a queue read identifier serve different purposes.

Checks 1–3 · Why Roblox MemoryStoreQueue delivers a task againOpen full-size image ↗
Checks 1–3 · Why Roblox MemoryStoreQueue delivers a task again

Make the retry safe #

Assign a stable task ID before enqueueing. For an outcome stored in one key, check the ID and apply the change in one atomic update. A separate check and write can race when two workers run. A room refresh can write a calculated state rather than incrementing a counter on every read. Acknowledge the queue separately after success.

Read one item while debugging #

Start with one item per read and a bounded waitTimeout. A failure partway through a batch otherwise makes it harder to tell which items were applied. Distinguish an empty read, a failed call and work completed without acknowledgment. Back off during repeated errors instead of making a tight loop of requests.

Check the outcome and expiration #

Test a successful read and acknowledgment, a retry after a stopped worker, and expiration of an obsolete test task. Record only the time, task ID and stage needed for diagnosis. A successful result is one outcome even when the queue offers the job again.

Checks 4–6 · Why Roblox MemoryStoreQueue delivers a task againOpen full-size image ↗
Checks 4–6 · Why Roblox MemoryStoreQueue delivers a task again
What to checkExpected result
Temporary jobSet expiration
ReadHides the item
RetrySame task ID
EffectApplied once
AcknowledgmentAfter success
ExpirationItem disappears

Original sources

Roblox Creator Hub · MemoryStoreQueue
Roblox Creator Hub · MemoryStoreService.GetQueue
Roblox Creator Hub · Memory store best practices