Skip to main content

MAX_RETRY_AFTER_SECS

Constant MAX_RETRY_AFTER_SECS 

Source
pub const MAX_RETRY_AFTER_SECS: u64 = 60;
Expand description

Ceiling, in seconds, on a single Retry-After sleep inside the HTTP retry loops of crate::chat_api and crate::embedding_api.

The header is server-controlled and was honoured verbatim: a provider (or anything answering in its place) replying Retry-After: 86400 put a CLI that is supposed to be born, run and die to sleep for a full day, with no output and no way to tell the stall apart from a hang.

The value is anchored on the budget that already governs the TOTAL wait: enrich.rate_limit_deadline_secs defaults to 3600s (crate::constants::DEFAULT_RATE_LIMIT_DEADLINE_SECS). One step must stay well under that or the deadline stops meaning anything — at 60s the worst case of openrouter_http::MAX_RETRIES rate-limited attempts is 240s, under 7% of the deadline, so the operator’s budget still decides when the run gives up. It is also far above any wait a healthy provider advises, so the cap only fires on values that were never actionable anyway.

Distinct from crate::constants::ENRICH_BACKOFF_CEILING_SECS (900s), which bounds the drain’s own backoff BETWEEN items, not one HTTP attempt. Coordination wait against a remote limit, so it takes no XDG key.