Method ReleaseAsync
- Namespace
- MailFathom.Application.Coordination
- Assembly
- MailFathom.Application.dll
ReleaseAsync(WorkScope, WorkLeaseHolder, CancellationToken)
Gives a held scope back at once, so another replica can take it without waiting out the expiry.
Task<bool> ReleaseAsync(WorkScope scope, WorkLeaseHolder holder, CancellationToken cancellationToken)
Parameters
scopeWorkScopeThe scope to release.
holderWorkLeaseHolderThe hold claiming to hold it.
cancellationTokenCancellationTokenCancels the write.
Returns
Remarks
What a graceful shutdown does with what it was holding, and an optimization of the ordinary case only: the expiry is what covers a crash, and nothing may be built on a release having happened. Writing nothing is the point of the compare-and-set — a late release from a hold that was already reclaimed would otherwise free a scope another replica is working under.
Exceptions
- ArgumentNullException
Thrown when
scopeorholderis null.