pub struct RetryPolicy { /* private fields */ }Expand description
How often, and how patiently, a failed request is repeated.
The default is five attempts with a doubling delay from one second, capped at ten — about fifteen seconds of patience, which covers a proxy restart or a scheduler reconnect without making a genuinely broken cluster feel hung.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn new(
attempts: u32,
initial_backoff: Duration,
max_backoff: Duration,
) -> Self
pub fn new( attempts: u32, initial_backoff: Duration, max_backoff: Duration, ) -> Self
attempts tries in total, waiting initial_backoff after the first
failure and doubling up to max_backoff.
attempts is clamped to at least one: zero attempts would mean never
sending the request at all.
Sourcepub fn quiet(self) -> Self
pub fn quiet(self) -> Self
The same policy, retrying without saying so.
A retry normally announces itself on stderr, so a launcher that pauses for fifteen seconds says why rather than looking hung. Inside a job that same stream is the cluster’s diagnostic channel — a bounded buffer the operation UI shows, and the one the job’s own messages go to — so a worker that talks to the cluster while a proxy is flaky would fill it with retry chatter.
With the tracing feature on the announcement is a WARN event rather
than a line on stderr, and this mutes that too. Same reason: a
subscriber installed inside a job is, more often than not, writing to
the very buffer this exists to protect. RetryPolicy::loud puts the
messages back whichever form they take.
A Client built inside a job is quiet already; this is
for choosing it anywhere else:
use ytsaurus_client::{Client, RetryPolicy};
let client = Client::new("http://localhost:8000")
.with_retries(RetryPolicy::default().quiet());Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more