Skip to main content

ReconnectConfig

Struct ReconnectConfig 

Source
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: Duration

Initial reconnect backoff delay. Must be non-zero before reconnecting.

§max_backoff: Duration

Maximum 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: usize

Maximum reconnect attempts before surfacing the last connection error.

Implementations§

Source§

impl ReconnectConfig

Source

pub const fn new( initial_backoff: Duration, max_backoff: Duration, max_attempts: usize, ) -> Self

Creates reconnect settings with every field supplied explicitly.

Trait Implementations§

Source§

impl Clone for ReconnectConfig

Source§

fn clone(&self) -> ReconnectConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReconnectConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ReconnectConfig

Source§

impl PartialEq for ReconnectConfig

Source§

fn eq(&self, other: &ReconnectConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ReconnectConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more