Class JobExecutionSettings
- Namespace
- MailFathom.Application.Jobs.Execution
- Assembly
- MailFathom.Application.dll
Bounds one pass of the worker: how much it takes, how long it holds it, how long one job may run, and how often a transient failure is retried.
public sealed record JobExecutionSettings : IEquatable<JobExecutionSettings>
- Inheritance
-
JobExecutionSettings
- Implements
- Inherited Members
Remarks
The ordering between the two durations is the whole reason this is validated rather than passed as loose values. An attempt has to be cancelled before its lease can expire underneath it, because a lease that ran out while its holder was still working is a second worker taking the same job — so a timeout at or above the lease duration is refused rather than warned about.
The renewal interval is derived rather than configured, at half the lease. A third duration would be a third way for the three to disagree, and half a lease is the margin the ordering above needs: a renewal that fails once still leaves a whole half-lease before anything can reclaim the job.
The attempt bound and the two retry delays are the queue's own budget for repeating a job, and there is exactly one of them. A handler does not bring its own: what it calls is already retried inside one attempt by the resilience pipeline of the dependency it reached, and a second bound at this level would multiply against that one instead of bounding anything.
Properties
- BatchSize
Gets the greatest number of jobs one pass takes.
- ExecutionTimeout
Gets how long one job may run before it is cancelled.
- LeaseDuration
Gets how long a claim holds each job it takes.
- LeaseRenewalInterval
Gets how often a held job's lease is pushed further out while its handler works.
- MaxAttempts
Gets how many attempts one job may be handed out for before a transient failure dead-letters it.
- RetryBaseDelay
Gets the delay the first retry is drawn around, from which the doubling grows.
- RetryMaxDelay
Gets the ceiling a grown retry delay never exceeds.
Methods
- Create(int, TimeSpan, TimeSpan, int, TimeSpan, TimeSpan)
States the bounds one pass runs under.