A periodic database cleanup in a Node.js backend should start with the least complex shape that meets the recovery requirement: a cron request to a short, idempotent HTTP cleanup handler. That is the right default for deleting expired webhook attempts, compacting delivery records, or marking old failures as terminal. You do not need a queue consumer merely because the word “retry” appears in the design.
The boundary changes when one run can exceed 900 seconds, when the database work needs fan-out, or when an operator needs durable replay. Then use cron as the clock and a queue plus workers as the execution layer. The scheduler remains boring. The recovery path becomes explicit.
The page arrives before the cleanup does
The alert an on-call engineer sees is usually not “cron failed.” It is a webhook delivery table whose pending rows have crossed their age threshold, followed by duplicate outbound attempts after a manual retry.…