Skip to main content

CanRetry

Trait CanRetry 

Source
pub trait CanRetry {
    // Required method
    fn can_retry(&self) -> bool;

    // Provided methods
    fn is_no_available_addresses(&self) -> bool { ... }
    fn rate_limit_ban_duration(&self) -> Option<Duration> { ... }
    fn is_node_failure(&self) -> bool { ... }
}
Expand description

Returns true if the operation can be retried.

Required Methods§

Source

fn can_retry(&self) -> bool

Returns true if the operation can be retried safely.

Provided Methods§

Source

fn is_no_available_addresses(&self) -> bool

Returns true if this error represents a “no available addresses” condition.

When all addresses have been banned due to errors, the client returns this error. Retry logic uses this to return the last meaningful error instead of this one.

Source

fn rate_limit_ban_duration(&self) -> Option<Duration>

If this error is a gRPC ResourceExhausted (Envoy rate-limit) that carries a RateLimit-Reset metadata header, returns the server-advertised ban duration (clamped to a safe range). Returns None for all other errors and for rate-limit errors that carry no usable header (the caller falls back to the normal exponential ban ladder in that case).

Source

fn is_node_failure(&self) -> bool

👎Deprecated:

Use !can_retry() instead

Get boolean flag that indicates if the error is retryable.

Deprecated in favor of CanRetry::can_retry.

Implementations on Foreign Types§

Source§

impl CanRetry for Status

Source§

fn rate_limit_ban_duration(&self) -> Option<Duration>

Returns the Envoy-advertised ban duration for a ResourceExhausted response, or None if this is not a rate-limit or carries no usable RateLimit-Reset header.

Envoy’s global rate-limit filter emits RateLimit-Reset: <seconds> when LIMIT_RESPONSE_HEADERS_ENABLED=true is set on the Lyft RLS container (see packages/dashmate/docker-compose.rate_limiter.yml). The value is the whole-second count until the per-IP window resets.

Parse rules (adversarial-input safe):

  • Non-ResourceExhausted code → None.
  • Header absent, non-numeric, or 0None (caller uses normal ban ladder).
  • Valid positive integer → clamped to [[MIN_RATE_LIMIT_BAN_SECS, MAX_RATE_LIMIT_BAN_SECS]] (dapi_client.rs) and returned as Some(Duration).
Source§

fn can_retry(&self) -> bool

Implementors§