minSafeTtl
@rotorsoft/act-root / act-ops/src/idempotency / minSafeTtl
Function: minSafeTtl()
minSafeTtl(
profile):number
Defined in: libs/act-ops/src/idempotency/min-safe-ttl.ts:71
Minimum safe TTL in milliseconds for a receiver-side IdempotencyStore window, given the sender's retry profile.
The envelope is:
ttl = (backoff_sum + (maxRetries + 1) * timeoutMs) * safetyFactor
where backoff_sum is the sum of per-retry delays from the chosen
strategy, multiplied by 1.5 if jitter is enabled (the
worst-case multiplier in [0.5, 1.5)). safetyFactor defaults
to 4 because operators almost always want headroom over the bare
envelope โ slow networks, clock skew, and incident-window retries
stretch the real-world maximum past the computed one.
A sender that never stops retrying (maxRetries: Infinity) has no
envelope to outlast, so no finite window is safe for it. This throws
rather than returning a number that would read as safe. Size the
window yourself with an explicit ttlMs, as long as a duplicate must
still be recognized.
Parametersโ
profileโ
Returnsโ
number
Throwsโ
When maxRetries is Infinity