Class JobQueuePass
- Namespace
- MailFathom.Application.Jobs.Execution
- Assembly
- MailFathom.Application.dll
Takes one batch of due jobs this process can run, and runs them under the capacity the instance allows.
public sealed class JobQueuePass
- Inheritance
-
JobQueuePass
- Inherited Members
Remarks
One claim and one owner per pass. The owner identifies the attempt rather than the process, which is what lets a write be refused once the lease has moved on, and a batch shares one because the claim that stamped them is one statement.
How many of a batch run at once is not the batch's business: the batch is what one claim took, and the ceiling is what the instance may spend on background work. Every claimed job is therefore dispatched at once and each waits for JobConcurrencyGate to let it through, so raising the batch size buys fewer round trips rather than more work in flight.
A process with no handler claims nothing at all, rather than claiming and abandoning. That is the ordinary state of a build whose consumers have not arrived, and it is also what makes a rolling deployment safe: work an older replica cannot run stays where it is for a newer one.
Constructors
- JobQueuePass(IJobStore, JobHandlerRegistry, IJobAttemptRunner, JobConcurrencyGate, JobExecutionSettings)
Initializes the pass from the queue it claims out of and the bounds it claims and runs under.
Methods
- RunAsync(CancellationToken)
Claims one batch and runs it, reporting what each job did.