Table of Contents

Constructor JobLease

Namespace
MailFathom.Application.Jobs
Assembly
MailFathom.Application.dll

JobLease(JobLeaseOwner, DateTimeOffset)

Holds one job for one attempt, until an instant rather than until somebody lets go.

public JobLease(JobLeaseOwner Owner, DateTimeOffset ExpiresAt)

Parameters

Owner JobLeaseOwner

The attempt the lease is held by.

ExpiresAt DateTimeOffset

The instant after which the job is claimable again whatever the holder is doing.

Remarks

A lease is a stamped row rather than a flag, which is what makes a crash recoverable without anything being told a process died: an expired lease is claimable again, so work in flight when a process stops is picked up on its own. The claiming transaction ends with the claim, because the work itself reaches a mail server or a model provider and no transaction may stay open across one.

Two things keep that safe rather than merely likely. Every write against a leased job is conditional on the owner still matching, so a late writer whose lease was reclaimed writes nothing. And the timeout an attempt runs under is strictly shorter than the lease it holds, so an attempt is cancelled before its lease can expire underneath it — which is what makes two workers running one job structurally impossible rather than rare.