Method DelayBeforeNextAttempt
- Namespace
- MailFathom.Application.Jobs.Execution
- Assembly
- MailFathom.Application.dll
DelayBeforeNextAttempt(TimeSpan, TimeSpan, int)
Computes how long a job waits before its next attempt.
public static TimeSpan DelayBeforeNextAttempt(TimeSpan baseDelay, TimeSpan maxDelay, int attemptCount)
Parameters
baseDelayTimeSpanThe delay the first retry is drawn around, from which the doubling grows.
maxDelayTimeSpanThe ceiling a grown delay never exceeds.
attemptCountintHow many attempts the job has already been handed out for, counting from one.
Returns
- TimeSpan
A jittered delay of at least half the grown ceiling and at most
maxDelay.
Exceptions
- ArgumentOutOfRangeException
Thrown when
baseDelayis not positive, whenmaxDelayis below it, or whenattemptCountis not positive.