Menu

Draining Game Worker Pools: Node.js Cron, Postgres due_at, Queues, and Idempotency
📰

Draining Game Worker Pools: Node.js Cron, Postgres due_at, Queues, and Idempotency

DEV Community: postgres·FrostY45·about 1 hour ago
#HYoF9VA8
#devtopostgresql#devto#dev#reminder#provider
Reading 0:00
15s threshold

Short answer: keep reminder time in Postgres, let a minute-level cron enqueue bounded batches, and make workers drain the rate-limited pool with leases, backoff, and a delivery ledger. The recovery rule matters more than the cron expression: a missed tick must leave due rows discoverable, while a repeated delivery must not notify a player twice.

This is a good fit for game backends that send user reminders around events, energy refills, or match windows. The scheduler should find work. It should not perform the provider call. That separation gives an on-call engineer a useful question during an incident: is the reminder due, claimed, queued, retrying, or delivered?

Should a Node.js cron scan Postgres due_at rows for user reminder queue work?

Yes, when the database already owns reminder state and the latency target is measured in minutes. A cron tick is only a wake-up signal. The authoritative query is due_at <= now() plus the application state that says the reminder is still eligible.…

Continue reading — create a free account

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