pub struct RetryScope { /* private fields */ }Expand description
RAII scope that attributes every backoff sleep recorded on this thread
during its lifetime to name (a publisher or stage label). Restores the
enclosing scope on drop, so nested/sequential scopes compose. Install one
around each publisher’s run and around a stage’s whole retrying section,
and one per fan-out worker (via RetryScope::inherit) so the worker’s
backoff ends up under the same label as its parent’s.
Implementations§
Source§impl RetryScope
impl RetryScope
Sourcepub fn enter(name: impl Into<String>) -> Self
pub fn enter(name: impl Into<String>) -> Self
Enter a retry-attribution scope named name on the calling thread.
Sourcepub fn inherit(label: Option<String>) -> Option<Self>
pub fn inherit(label: Option<String>) -> Option<Self>
Re-enter, on a fan-out worker thread, the scope its spawning thread
held — the label read from current_scope before the spawn.
None (the spawning thread held no scope) installs nothing, so the
worker’s backoff falls to the unattributed bucket exactly as the
parent’s would have.