Three places can retry, one can count: who owns recovery in a daily pipeline
Published · Updated
An unsupervised pipeline usually has several layers that each believe retrying is their job. A retry budget scoped to one process cannot see the others, which is how failures stay masked.
A pipeline that publishes eight SEO articles a day with zero manual intervention, across four country domains and seven languages, has nobody to ask what happened when a step fails. So it recovers on its own. The question that decides whether that recovery is safe is not whether retries exist. It is how many layers of the pipeline believe that retrying is their job.
Four layers, each reasonable on its own
An HTTP client retries a timed-out request. The worker loop catches the exception and tries the item again. A fallback chain moves to the next model: we built a platform with three model fallback levels that publishes articles daily without supervision. Then the next scheduled tick re-claims the row, because its status never reached done. Every one of those behaviours is defensible in isolation. Together they multiply attempts against the same failing dependency.
A retry budget counts only what one process can see
The SRE guidance is to consider a server-wide retry budget: only allow 60 retries per minute in a process, and if the budget is exceeded, do not retry, just fail the request. The scope matters more than the number. A budget enforced inside the worker cannot see attempts made by the HTTP library, nor attempts made by a later scheduler tick in a different process. The counter passes while the dependency absorbs far more traffic than the budget allows.
Failures masked by retries
White-box monitoring allows detection of imminent problems and of failures masked by retries. That second category is exactly what layered recovery produces: the publication lands, the final status is success, and nothing in the result record says it took several passes through two fallback levels. A black-box probe will not find it either. For a service targeting 99.9% annual uptime, that is to say no more than 9 hours aggregate downtime per year, checking for a 200 status more than once or twice a minute is already unnecessarily frequent.
Ripples, not load
A cascading failure is one that grows over time as a result of positive feedback, and uncoordinated retries are a common source of it. If retries are not randomly distributed over the retry window, a small perturbation such as a network blip can cause retry ripples to schedule at the same time. Cron-driven pipelines start from an aligned position by construction: the day's work is released at one instant, so its failures and its second attempts align too. Always use randomised exponential backoff when scheduling retries.
Put the counter on the row
A queue-like table is already the shared state that several consumers agree on. With SKIP LOCKED, any selected rows that cannot be immediately locked are skipped, which avoids lock contention with multiple consumers at the cost of an inconsistent view of the data; with NOWAIT, the statement reports an error instead of waiting. Either way, an attempt count stored on the row survives process restarts and scheduler ticks, which is more than any in-memory budget does.
Decide who owns recovery
Pick one layer to own retries and make the others fail fast, so attempts are observable in a single place. Increment the attempt column before the work, not after, so a crash still counts. Treat a re-claim by a later tick as a retry even though no code called retry, and cap it. Record attempts alongside the final outcome, because errors is one of the four golden signals and a masked error is still an error.
The cheap version of this work is a schema change and a deletion: one attempt counter on the queue row, and the removal of retry logic from every layer that is not the designated owner. Nothing about the pipeline gets faster. What changes is that a run which succeeded on its fourth pass stops reading, in the results table, exactly like one that succeeded on its first.
Sources
Google SRE Book — Monitoring Distributed Systems — https://sre.google/sre-book/monitoring-distributed-systems/
Google SRE Book — Addressing Cascading Failures — https://sre.google/sre-book/addressing-cascading-failures/
PostgreSQL 18 Documentation — SELECT (The Locking Clause) — https://www.postgresql.org/docs/current/sql-select.html
Neurolinks case study — Four markets, one codebase — https://neurolinks.be/work/tatano-energy
Neurolinks case study — A personal brand that publishes itself — https://neurolinks.be/work/matthieu-pesesse-media
Working on a project where these methods apply?