Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
18 lines
602 B
Rust
18 lines
602 B
Rust
//! Shared exponential retry delays with jitter.
|
|
|
|
use std::time::Duration;
|
|
|
|
use rand::Rng;
|
|
|
|
const INITIAL_DELAY_MS: u64 = 200;
|
|
const BACKOFF_FACTOR: f64 = 2.0;
|
|
|
|
/// Return a retry delay starting at 200 ms and doubling on each subsequent attempt,
|
|
/// with up to 10% jitter. Attempts zero and one both use the initial delay.
|
|
pub fn backoff(attempt: u64) -> Duration {
|
|
let exp = BACKOFF_FACTOR.powi(attempt.saturating_sub(1) as i32);
|
|
let base = (INITIAL_DELAY_MS as f64 * exp) as u64;
|
|
let jitter = rand::rng().random_range(0.9..1.1);
|
|
Duration::from_millis((base as f64 * jitter) as u64)
|
|
}
|