Method RenewAsync
- Namespace
- MailFathom.Application.Coordination
- Assembly
- MailFathom.Application.dll
RenewAsync(WorkScope, WorkLeaseHolder, TimeSpan, CancellationToken)
Pushes a held lease further out, so a long-running hold is not taken from underneath it.
Task<WorkLease?> RenewAsync(WorkScope scope, WorkLeaseHolder holder, TimeSpan leaseDuration, CancellationToken cancellationToken)
Parameters
scopeWorkScopeThe scope whose lease is renewed.
holderWorkLeaseHolderThe hold claiming to hold it.
leaseDurationTimeSpanHow much longer the scope is held from now.
cancellationTokenCancellationTokenCancels the write.
Returns
Remarks
An absent answer is the signal to stop working, and to stop at once rather than at the next pass: the scope belongs to another hold, so anything this one goes on to commit would be a second writer's.
The condition is the holder rather than the expiry, so a hold whose lease has run out but which nothing has taken renews it and goes on working. That is safe because nothing else holds the scope, and refusing on the expiry instead would abandon work nobody else had taken.
Exceptions
- ArgumentNullException
Thrown when
scopeorholderis null.- ArgumentOutOfRangeException
Thrown when
leaseDurationis not positive.