Method ScheduleRetryAsync
- Namespace
- MailFathom.Application.Jobs
- Assembly
- MailFathom.Application.dll
ScheduleRetryAsync(JobId, JobLeaseOwner, JobFailureRecord, TimeSpan, CancellationToken)
Gives a held job back after a transient failure, claimable again once the delay named has passed.
Task<DateTimeOffset?> ScheduleRetryAsync(JobId jobId, JobLeaseOwner user, JobFailureRecord failure, TimeSpan retryDelay, CancellationToken cancellationToken)
Parameters
jobIdJobIdThe job to schedule another attempt for.
userJobLeaseOwnerThe attempt claiming to hold it.
failureJobFailureRecordWhat this attempt failed with, which replaces whatever the previous one recorded.
retryDelayTimeSpanHow long after the store records the retry no claim may take the job again.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task<DateTimeOffset?>
The instant the job becomes claimable again, as the store recorded it, or null when this attempt no longer held the job.
Remarks
The attempt stays counted, because it was handed out and spent: the count is what the attempt bound is read against, and a retry that gave it back would loop forever. Delaying the job rather than releasing it is what separates this from a shutdown — a job returned to the queue at once after failing would be taken again as fast as the queue can hand it out.
A delay rather than an instant, because the store measures it from the same clock every claim judges the job against; an instant computed from the caller's clock would elapse early or late by however far that clock drifts.
Exceptions
- ArgumentNullException
Thrown when
userorfailureis null.- ArgumentOutOfRangeException
Thrown when
retryDelayis negative.