Table of Contents

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

scope WorkScope

The scope to release.

holder WorkLeaseHolder

The hold claiming to hold it.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<bool>

true when this hold still held the scope and the release was written; otherwise false.

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 scope or holder is null.