top of page

Should Your Integration Treat Retry-After as Seconds or a Date?

Oct 24
3 min read
Retry-After: Parse the Value Before Scheduling a Retry: Parse the documented format; Check deadline and replay safety; Schedule a bounded retry.

An integration receives a Retry-After header and passes it into an integer parser. It works when the value is 120 and fails when the server supplies a date. The resulting retry may happen immediately, much later than intended or not at all.


The header's format is a small detail with a large operational consequence. Treat its interpretation as a defined boundary in the retry policy.


Support the two documented forms


MDN's Retry-After reference describes either an HTTP date or a non-negative integer number of seconds. The seconds form indicates a delay after receiving the response.


Do not assume a number means milliseconds. Do not treat an HTTP date as a locale-dependent date typed by a user. Use parsing appropriate to the documented protocol format.


Example: a two-minute wait


In an illustrative test, a response received at 10:00:00 UTC includes a delay of 120 seconds. The earliest retry under that instruction is 10:02:00 UTC.


A separate fixture can provide an HTTP date corresponding to that same instant. The two inputs should produce consistent scheduling decisions under the controlled test clock.


Keep timing separate from replay safety


A wait instruction does not prove that repeating the original operation is safe. The client still needs to consider the operation's semantics, any evidence of completion and its existing duplicate-prevention policy.


Record whether the response explicitly rejected the operation or whether the outcome remains uncertain. If a prior attempt may already have created a record, resolve that ambiguity through the integration's documented recovery path before blindly submitting it again.


Check the business deadline


Suppose a report must finish by 10:01, but the next permitted attempt is 10:02. The appropriate outcome may be to mark the job delayed and notify its owner through the established workflow.


Do not shorten the server's wait merely to fit the deadline. The conflict should be visible as an operational decision, not hidden inside a timer.


Define invalid and extreme-value handling


Create fixtures for a valid integer, a valid HTTP date, an invalid value, a past date and an unusually long delay. Specify the fallback behavior before testing.


For a missing or invalid header, use the documented local retry policy where retrying is otherwise appropriate. Avoid making an unbounded immediate loop the default.


For a delay beyond the job's useful lifetime, defer or stop with an explicit reason. If the scheduler cannot represent the delay safely, do not silently overflow or cap it to an earlier instant.


Consider clock accuracy for date-based instructions. Record the received value and the computed next-attempt time so a scheduling error can be diagnosed without guessing what the server sent.


Verify the actual attempt times


Test with a controllable clock or a bounded integration fixture. Compare scheduled time, actual execution time and the number of attempts.


A correctly computed timestamp does not help if a worker ignores it after restarting. Check that deferred work retains its timing information through the recovery behavior your system supports.


Use a maximum attempt count or elapsed-time budget appropriate to the task. Respecting one header does not justify retrying forever.


Include a worker-restart fixture in the scheduling review. Pause the controlled worker after recording the response, restart it before the permitted retry time and inspect the next execution. The job should retain its timing constraint and attempt history. Record the outcome without generating real customer side effects; a synthetic endpoint is sufficient for this check.


The acceptance record should show how each header form is parsed, when the next attempt can occur and what happens when replay is unsafe or the deadline cannot be met. This makes retry behavior understandable to both the developer and the person waiting for the business result.


Continue with the related FutureOS guide for the related planning decision.


The published FutureOS introduction describes the project as being in prelaunch. Use this guide to prepare a concrete project discussion; it does not announce an available FutureOS feature.



Prepared with AI assistance. Primary sources checked on October 24, 2026. Examples and procedures are illustrative editorial guidance, not FutureOS product announcements or an independently reviewed assessment.

Comments


bottom of page