strip session-added comments
This commit is contained in:
@@ -148,22 +148,14 @@ pub enum DomainEvent {
|
||||
pub trait AckHandle: Send + Sync {
|
||||
async fn ack(&self) -> Result<(), DomainError>;
|
||||
async fn nack(&self) -> Result<(), DomainError>;
|
||||
/// Redeliver after `delay` without counting a failed attempt: for a
|
||||
/// delivery that was not tried (it is blocked behind a live claim), so it
|
||||
/// must not burn the retry budget that `nack` spends. A broker may still
|
||||
/// count the redelivery itself: JetStream does, toward `max_deliver`.
|
||||
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);
|
||||
|
||||
@@ -194,7 +186,6 @@ pub struct EventEnvelope {
|
||||
}
|
||||
|
||||
impl EventEnvelope {
|
||||
/// `id` is `None` only for events queued before identities existed.
|
||||
pub fn new(id: Option<EventId>, event: DomainEvent, ack: Box<dyn AckHandle>) -> Self {
|
||||
Self { event, id, ack }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user