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.
Clean closes: a clean/graceful server-side stream close is a
retryable drop, not a run end: the worker redials through the same
budgeted, backed-off cycle, so routine server deploys cost at most
transient budget that heals. Only a persistent clean-close loop exhausts
the budget (surfacing crate::error::WorkerError::CleanCloseExhausted).
An explicit protocol drain signal (“closing, do not reconnect”) is
planned for the worker-protocol ack wave and will refine the clean-close
case.
Shutdown during a drop backoff: every SDK races the backoff sleep
against the shutdown signal and returns promptly, but the run outcome
currently diverges: this SDK surfaces the pending drop error (a clean
close pending recovery still ends Ok), while the Python and TypeScript
workers return cleanly. Aligning the outcome cross-SDK is deferred to
the protocol drain-signal wave.
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