nats nak w/ shared retry_backoff, exhausted log; no 'will retry' lie
This commit is contained in:
@@ -155,6 +155,14 @@ pub trait AckHandle: Send + Sync {
|
||||
async fn defer(&self, delay: std::time::Duration) -> Result<(), DomainError>;
|
||||
}
|
||||
|
||||
/// Wait before retrying an event whose `attempt`-th delivery just failed:
|
||||
/// 5s doubling per attempt, capped at 5 minutes. Every backend (SQLite queue,
|
||||
/// JetStream nak, outbox relay) uses this one schedule.
|
||||
pub fn retry_backoff(attempt: u32) -> std::time::Duration {
|
||||
let secs = 5u64 * (1u64 << attempt.min(6));
|
||||
std::time::Duration::from_secs(secs.min(300))
|
||||
}
|
||||
|
||||
/// Stable identity of one queued event; the key for de-duplicating deliveries.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct EventId(uuid::Uuid);
|
||||
|
||||
Reference in New Issue
Block a user