Node.js and Postgres Cleanup Jobs for 15-Minute Reservation Expiry
A developer guide explains how to release expired 15-minute reservations reliably using a short cron trigger and a Postgres query that owns the state. It recommends a single transaction that claims a bounded batch with row locks, relying on at-least-once execution and idempotent state changes rather than promising exactly-once delivery. The author argues a queue should only be added when one run finds more work than one process can handle or when items need independent retries. Operators should be able to see the age of the oldest eligible row and the count of failed attempts. The design also uses a partial index and SKIP LOCKED to keep overlapping runs from contending for the same rows.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in