Table of Contents

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

jobId JobId

The job whose lease is renewed.

owner JobLeaseOwner

The attempt claiming to hold it.

leaseDuration TimeSpan

How much longer the job is held from now.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<JobLease>

The renewed lease, or null when this attempt no longer holds the job.

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 owner is null.

ArgumentOutOfRangeException

Thrown when leaseDuration is not positive.