pub struct RetryPolicy {
pub max_retries: u32,
pub initial_backoff_ms: u64,
pub max_backoff_ms: u64,
}Expand description
Retry/backoff settings exposed on both connector configs.
Fields§
§max_retries: u32Retries after the first attempt for throttled or transient failures. Default 8.
initial_backoff_ms: u64Initial backoff in milliseconds (doubled per attempt, jittered). Default 100.
max_backoff_ms: u64Backoff ceiling in milliseconds. Default 10000.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn delay(&self, attempt: u32) -> Duration
pub fn delay(&self, attempt: u32) -> Duration
Jittered delay before retry number attempt (0-based).
Sourcepub async fn run<T, F, Fut>(&self, what: &str, op: F) -> Result<T, String>
pub async fn run<T, F, Fut>(&self, what: &str, op: F) -> Result<T, String>
Run op until it succeeds, a fatal error occurs, or the retry budget is
spent. op returns the error’s (code, message); what names the call
in the final error message (the caller picks the FaucetError variant).
Sourcepub async fn run_in<T, F, Fut>(
&self,
ctx: &CallContext,
call: &'static str,
what: &str,
fail: fn(String) -> FaucetError,
op: F,
) -> Result<T, FaucetError>
pub async fn run_in<T, F, Fut>( &self, ctx: &CallContext, call: &'static str, what: &str, fail: fn(String) -> FaucetError, op: F, ) -> Result<T, FaucetError>
run with every attempt made through ctx as one backend
call named call (#880): bounded by its timeout and deadline, stopped
by its cancel token, metered on its recorder; backoffs wait through it
too. A spent budget or a fatal error becomes fail(message); the
context running out comes back as its own error.
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 moreimpl Copy for RetryPolicy
Source§impl Debug for RetryPolicy
impl Debug for RetryPolicy
Source§impl Default for RetryPolicy
impl Default for RetryPolicy
Source§fn default() -> RetryPolicy
fn default() -> RetryPolicy
Source§impl<'de> Deserialize<'de> for RetryPolicy
impl<'de> Deserialize<'de> for RetryPolicy
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RetryPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RetryPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for RetryPolicy
Source§impl JsonSchema for RetryPolicy
impl JsonSchema for RetryPolicy
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for RetryPolicy
impl PartialEq for RetryPolicy
Source§impl Serialize for RetryPolicy
impl Serialize for RetryPolicy
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for RetryPolicy
Auto Trait Implementations§
impl Forget for RetryPolicy
impl Freeze for RetryPolicy
impl Move for RetryPolicy
impl RefUnwindSafe for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnsafeUnpin for RetryPolicy
impl UnwindSafe for RetryPolicy
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more