Skip to main content

registry_aware_backoff

Function registry_aware_backoff 

Source
pub fn registry_aware_backoff(
    base: Duration,
    max: Duration,
    attempt: u32,
    strategy: RetryStrategyType,
    jitter: f64,
    is_new_crate: bool,
    error_message: &str,
) -> Duration
Expand description

Registry-aware backoff. Layered on top of the generic backoff_delay: if we’re publishing a brand-new crate and the retry is caused by a rate-limit signal, floor the delay at CRATES_IO_NEW_CRATE_WINDOW so we stop burning retries during the 10-minute window crates.io has already told us to wait through. Everything else uses the generic delay.

Preflight discovers is_new_crate already (one check_new_crate call per package at publish start); wiring it here costs no additional I/O. See issues #94 and #91 for the design discussion.