Table of Contents

Class JobSchedulePass

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

Enqueues the work whose occasion has passed, once per occasion, and passes over the occasions that were missed.

public sealed class JobSchedulePass
Inheritance
JobSchedulePass
Inherited Members

Remarks

This is dispatch and not a scheduler. It owns no loop, no timer, and no queue: it is one step the worker already polling the job queue takes before it claims, so recurring work reaches the same worker, the same concurrency ceiling, the same queue depth bound, and the same retry and dead-letter path as work an event enqueued. A schedule therefore adds an occasion to the existing mechanism rather than a second mechanism beside it.

A missed occasion is skipped rather than replayed. Only the most recent occasion at or before now is ever enqueued, so an instance that was down for a week comes back and runs the work once instead of beginning with a week of catch-up passes over somebody's mailbox. How many were passed over is counted and reported, because a burst that was deliberately not run must not look like a schedule that kept up.

One run per schedule at a time. The work a schedule repeats can outlast its own interval, so the job the previous occasion enqueued is asked about first: while it is still pending or held, this occasion is answered rather than started, and the schedule advances past it. That is the same answer the whole-mailbox rule run gives a second request, and it is what keeps a slow pass from queuing a copy of itself every interval.

Nothing here is exclusive between replicas, and it does not need to be. The identity of an execution is the schedule and the occasion together, so two instances reaching one occasion compose one key and the queue's own uniqueness answers the second with the job the first wrote.

Constructors

JobSchedulePass(IScheduledJobSource, IJobScheduleStore, IJobStore, TimeProvider)

Initializes the pass from the schedules it reads and the queue it dispatches into.

Methods

RunAsync(CancellationToken)

Decides about every declared schedule, and enqueues the ones whose occasion has passed.