fix: defer blocked deliveries, claim owner token
This commit is contained in:
@@ -48,6 +48,16 @@ impl AckHandle for NatsJetStreamAckHandle {
|
||||
.await
|
||||
.map_err(|e| DomainError::InfrastructureError(e.to_string()))
|
||||
}
|
||||
|
||||
/// JetStream counts every redelivery toward `max_deliver`, deferrals
|
||||
/// included. The delay is at least the remaining claim lease, so the
|
||||
/// deliveries allowed by `max_deliver` still span more than one lease.
|
||||
async fn defer(&self, delay: std::time::Duration) -> Result<(), DomainError> {
|
||||
self.message
|
||||
.ack_with(AckKind::Nak(Some(delay)))
|
||||
.await
|
||||
.map_err(|e| DomainError::InfrastructureError(e.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
// ── Core NATS ack handle (no-op) ─────────────────────────────────────────────
|
||||
@@ -62,6 +72,9 @@ impl AckHandle for NoopAck {
|
||||
async fn nack(&self) -> Result<(), DomainError> {
|
||||
Ok(())
|
||||
}
|
||||
async fn defer(&self, _: std::time::Duration) -> Result<(), DomainError> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
// ── Envelope construction helpers ────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user