Skip to main content

RetryPolicy

Trait RetryPolicy 

Source
pub trait RetryPolicy:
    Send
    + Sync
    + 'static {
    // Required method
    fn should_retry(&self, ctx: &RetryContext) -> ControlFlow<(), Duration>;
}
Expand description

Controls how the client reacts when an RPC call fails.

Implement this trait to provide custom flood-wait handling, circuit breakers, or exponential back-off.

Required Methods§

Source

fn should_retry(&self, ctx: &RetryContext) -> ControlFlow<(), Duration>

Decide whether to retry the failed request.

Return ControlFlow::Continue(delay) to sleep delay and retry. Return ControlFlow::Break(()) to propagate ctx.error to the caller.

Implementors§