Method RenewLeaseAsync
- Namespace
- MailFathom.Application.Jobs
- Assembly
- MailFathom.Application.dll
RenewLeaseAsync(JobId, JobLeaseOwner, TimeSpan, CancellationToken)
Pushes a held job's lease further out, so a long execution is not reclaimed underneath it.
Task<JobLease?> RenewLeaseAsync(JobId jobId, JobLeaseOwner user, TimeSpan leaseDuration, CancellationToken cancellationToken)
Parameters
jobIdJobIdThe job whose lease is renewed.
userJobLeaseOwnerThe attempt claiming to hold it.
leaseDurationTimeSpanHow much longer the job is held from now.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task<JobLease>
The renewed lease carrying the expiry the store recorded, or null when this attempt no longer holds the job.
Remarks
An absent answer is the signal to stop working: the lease expired and another attempt has the job, so anything this one goes on to produce would be a second execution's result.
Exceptions
- ArgumentNullException
Thrown when
useris null.- ArgumentOutOfRangeException
Thrown when
leaseDurationis not positive.