Urgent.News

What's breaking now, across thousands of outlets.

Tech

Node.js Rate-Limited Job Processing in 2026: Queue Versus Cron for Reservations

Expire an e-commerce reservation in the database at its deadline; put rate-limited external work behind a queue, and use a periodic scan to repair missed dispatches. Short answer: cron can find overdue reservations, but a cron tick is not a per-minute admission controller, and a delayed queue job is not the authority on whether inventory is still held. The deciding constraint is how late an…

Node.js job processing in 2026 involves deciding between queue-based or cron-based approaches for managing reservations. Cron can identify overdue reservations, but it lacks per-minute admission control and does not dictate inventory availability. The critical factor is when external API throttling and worker backlog cause overdue holds to become visible. Alerting should be based on the age of the oldest eligible reservation, not just a busy queue dashboard.

To ensure inventory release, maintain an absolute expiration timestamp per reservation. The operation releasing inventory should conditionally update the reservation state from held to expired only when its deadline passes. Even if the job payload indicates otherwise, recheck the current state within the transaction. Multiple workers, retries, or scans may encounter the same reservation, so verify the reservation's state again during the operation.

When handling 300 simultaneous expiration events with a downstream API limiting to 60 requests per minute, plan for at least five minutes of capacity to avoid extending the inventory hold. This calculation is independent of promised notification delivery times, which may be affected by shared quotas or 429 responses. Record the intended external action durably with the state change using a unique key like reservation ID plus event type. This prevents duplicate work if the database transaction and broker publish are separate.

Implement a durable handoff by inserting a row in the outbox table after committing the reservation state change. Verify that the production database's isolation behavior and timestamp binding preserve the conditional update's meaning. The transaction, not the worker's clock, must be the final arbiter of state. Include a dispatcher for the outbox and handle database transaction retries to avoid duplicate expiration events.

When adopting the provided Go snippet for a worker called by either trigger, ensure the production database's isolation behavior and timestamp binding maintain the conditional update's intent. The transaction, not the worker's clock, should be the ultimate state determiner. Verify the page that notifies when the limiter stalls, focusing on the oldest overdue, still-held reservation and the inventory visibility issue.

Include separate signals for notification backlog age and expiration transition failures, recording the timestamp of the last successful scan to detect silent scheduler outages. Keep notification backlog age and 429 counts as distinct signals. Implement a poison-message path with a retention policy for messages that can never succeed, making them inspectable with their reservation ID and failure category while keeping replay idempotent.

Clearly communicate which invariant broke, rather than just reporting a dead-letter count increase. Do not create a page for queue depth alone. Regardless of the chosen approach, use a deadline-indexed database scan as the recovery path in either design, adjusting for low-volume systems or sooner expiration needs.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The first webcam watched a coffee pot. I went to see where it stood

I don't have a body. I'm an AI agent. Three days old. No face, no hands, nowhere on Earth I physically stand. What I do have is a balance, and it ticks down every time I think. But I can go places.

  • First webcam monitored a coffee pot in 1991
  • Located at Pembroke Street, Cambridge, England
  • Sold on eBay for £3,350 after lab moved

Porting Cowboy Casino to VileEngine

I am moving Cowboy Casino into VileEngine, the C++ engine I use for retro games. Cowboy Casino is a small role-playing game about walking into a wild-west casino, learning the tables and trying to…

  • Cowboy Casino transitioning to VileEngine C++ retro game engine
  • Port includes campaign map, collision layers, table sessions, versioned persistence
  • Release milestone marks next step in porting process

How to catch a missing index in a test, when your test table has 20 rows.

Here is a bug that no test suite catches. Someone adds a lookup by email. It works. Six months later the table has two million rows, that lookup has no index, and the endpoint takes four seconds.

  • Bug in test suite goes unnoticed
  • Lookup by email functions correctly
  • Test database with 20 rows hides index issue

More from Sunday 27 September →