Table of Contents

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

jobId JobId

The job to schedule another attempt for.

user JobLeaseOwner

The attempt claiming to hold it.

failure JobFailureRecord

What this attempt failed with, which replaces whatever the previous one recorded.

retryDelay TimeSpan

How long after the store records the retry no claim may take the job again.

cancellationToken CancellationToken

Cancels 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 user or failure is null.

ArgumentOutOfRangeException

Thrown when retryDelay is negative.