Method TryClaimRunAsync
TryClaimRunAsync(UploadRecord, TimeSpan, CancellationToken)
Claims the run of an upload's handler for the server that calls it.
Declaration
ValueTask<IUploadRunClaim?> TryClaimRunAsync(UploadRecord upload, TimeSpan leaseDuration, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| UploadRecord | upload | The record of the upload, whose chunks have all been received. |
| TimeSpan | leaseDuration | How long the claim lasts unless it is renewed: the service renews it every quarter of this time while the handler runs. The service uses 1 minute. |
| CancellationToken | cancellationToken | A token that cancels the operation. |
Returns
| Type | Description |
|---|---|
| ValueTask<IUploadRunClaim> | The claim, or null if the upload already has a claim or an outcome, a chunk of it is being written, or it no longer exists. |
Remarks
While the claim's lease is current, GetAsync(string, string, CancellationToken) reports the upload as Running, and once it has lapsed, as Lapsed, which the service ends with an outcome of its own.