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 owner, TimeSpan leaseDuration, CancellationToken cancellationToken)
Parameters
jobIdJobIdThe job whose lease is renewed.
ownerJobLeaseOwnerThe attempt claiming to hold it.
leaseDurationTimeSpanHow much longer the job is held from now.
cancellationTokenCancellationTokenCancels the write.
Returns
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
owneris null.- ArgumentOutOfRangeException
Thrown when
leaseDurationis not positive.