failedRowIsDue static method
- OutboxEvent e,
- DateTime nowUtc
Whether a failed row is due for another automatic attempt: not past maxAttempts, and past an exponential-backoff window since its last attempt (30s, 60s, 120s, … capped at 1h).
Implementation
static bool failedRowIsDue(OutboxEvent e, DateTime nowUtc) {
if (e.attemptCount >= maxAttempts) return false;
final last = e.lastAttemptAt;
if (last == null) return true;
final shift = e.attemptCount.clamp(0, 20);
var delay = _baseBackoff * (1 << shift);
if (delay > _maxBackoff) delay = _maxBackoff;
return nowUtc.isAfter(last.toUtc().add(delay));
}