pub struct Budget {
pub attempts: u32,
pub first: Duration,
pub cap: Duration,
pub unsent_only: bool,
}Expand description
How long the wire is given to stop hiccuping.
Fields§
§attempts: u32Total attempts, the first one included. 1 = no retry at all.
first: DurationThe wait after the first failure; doubled each time, capped at cap.
cap: Duration§unsent_only: boolRetry only failures that prove the request NEVER LEFT THIS BOX.
For a GET or a DELETE this is off: they are idempotent, and asking twice costs nothing. For a POST that CREATES something it is on, because a connection reset after the bytes went out is ambiguous — the server may have made the thing and lost the answer — and retrying that is how one order becomes two servers on the invoice. A refused connection and a name that did not resolve are not ambiguous: nothing was sent.
Implementations§
Source§impl Budget
impl Budget
Sourcepub const fn api() -> Budget
pub const fn api() -> Budget
What an API read gets: four attempts over ~7 s of waiting. Long enough for a dropped connection and a re-dial, short enough that a cloud that is genuinely down is named within the minute rather than leaned on.