pub struct ReconnectConfig {
pub initial_backoff: Duration,
pub max_backoff: Duration,
pub max_attempts: usize,
}Expand description
Operator-supplied reconnect backoff settings.
The settings govern both session establishment and the run loop’s cumulative mid-run session-drop budget.
Budget reset: the cumulative drop budget resets to zero once an
established session proves healthy — it served at least one task, or it
stayed connected longer than max_backoff (measured monotonically from
successful registration to the moment the stream ended or dropped;
post-drop draining of in-flight activities never extends it). The cap is
the policy’s own definition of the longest pause, so a session outliving
it is demonstrably past the flapping regime, and a served task proves
end-to-end health. A genuinely flapping server — no session ever serves
a task or outlives max_backoff — exhausts the budget after exactly
max_attempts drops.
Drains and clean closes: a server-announced drain (the wire
DrainRequest frame) is an unbudgeted drop — the worker finishes
in-flight work and redials after initial_backoff; the drain
classification latches for the session, so even an abrupt end after the
frame stays drain-class. An unannounced clean stream close remains a
budgeted retryable drop: the worker redials through the same budgeted,
backed-off cycle, and only a persistent unannounced clean-close loop
exhausts the budget (surfacing
crate::error::WorkerError::CleanCloseExhausted).
Shutdown during a drop backoff: every SDK races the backoff sleep against the shutdown signal and returns promptly, and the run outcome is aligned across the Rust, Python, and TypeScript workers: a pending drain-class or clean-close drop ends the run cleanly, while a pending error-class drop surfaces its error — a supervisor sees “this worker was mid-fault” distinctly from “this worker drained cleanly”.
Fields§
§initial_backoff: DurationInitial reconnect backoff delay. Must be non-zero before reconnecting.
max_backoff: DurationMaximum reconnect backoff delay cap. Must be non-zero before reconnecting. Doubles as the session-health threshold for the drop-budget reset described on this type.
max_attempts: usizeMaximum reconnect attempts before surfacing the last connection error.
Implementations§
Trait Implementations§
Source§impl Clone for ReconnectConfig
impl Clone for ReconnectConfig
Source§fn clone(&self) -> ReconnectConfig
fn clone(&self) -> ReconnectConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReconnectConfig
impl Debug for ReconnectConfig
impl Eq for ReconnectConfig
Source§impl PartialEq for ReconnectConfig
impl PartialEq for ReconnectConfig
Source§fn eq(&self, other: &ReconnectConfig) -> bool
fn eq(&self, other: &ReconnectConfig) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ReconnectConfig
Auto Trait Implementations§
impl Freeze for ReconnectConfig
impl RefUnwindSafe for ReconnectConfig
impl Send for ReconnectConfig
impl Sync for ReconnectConfig
impl Unpin for ReconnectConfig
impl UnsafeUnpin for ReconnectConfig
impl UnwindSafe for ReconnectConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request