Class ExecutionHistoryOptions
- Namespace
- Quartz
- Assembly
- Quartz.dll
The bounds the shipped execution history is kept under.
public sealed class ExecutionHistoryOptions
- Inheritance
-
ExecutionHistoryOptions
- Inherited Members
Remarks
Sized by you: an age per result (Retention, RetentionByResult, MisfireRetention), a cap per job (MaxEntriesPerJob), and MaxEntriesPerScheduler as the backstop on the whole feed. Keep failures for a month and successes for a day, say, and cap a job that runs every second so it cannot crowd out the rest.
Properties
MaxEntriesPerJob
The most executions kept per job, failures not counted: 0, the default, keeps no per-job cap.
public int MaxEntriesPerJob { get; set; }
Property Value
Remarks
The oldest go first. An execution whose EffectiveResult is Failed is exempt: it neither counts towards the cap nor is removed by it, so a job that runs often cannot push its own failures out.
MaxEntriesPerScheduler
The most rows kept per scheduler, in each feed: 2000 by default. 0 records nothing.
public int MaxEntriesPerScheduler { get; set; }
Property Value
Remarks
The backstop: the oldest rows go first, whatever their result. The in-memory history also keeps at most this many JobRunStatus per scheduler, dropping the one run longest ago.
Zero is the opt-out, and it is an opt-out rather than a limit that keeps nothing: the recorder reads it and stops recording, so a process that does not want the history does not pay for the rows it would immediately discard. It is how a worker that maps the HTTP API — which turns recording on by default — turns it back off.
MaxInputBytes
The most UTF-8 bytes of input RecordInput keeps per execution: 16 KB by default.
public int MaxInputBytes { get; set; }
Property Value
Remarks
An input over it is not recorded, and the row says so with InputTooLarge: a cut input would be a different one. The in-memory history's memory for inputs is bounded by this times MaxEntriesPerScheduler.
MisfireRetention
public TimeSpan? MisfireRetention { get; set; }
Property Value
RecordInput
Whether each execution records the input it was given, so that it can be run again with it: false by default.
public bool RecordInput { get; set; }
Property Value
Remarks
The input is the string stored under JobInput, which
ScheduleJob<TJob, TInput> and UsingInput write; it lands in
Input. Nothing else of the job data map is recorded.
Off by default because an input can hold secrets, and the history keeps it as plain text for as long as it keeps the row. It is never written to a log.
Retention
How far back the history reaches: 24 hours by default. The age of every result RetentionByResult does not name.
public TimeSpan Retention { get; set; }
Property Value
Remarks
Applied when the history is read as well as when it is written, because a scheduler that has stopped running jobs never writes again — and it is exactly that scheduler whose page would otherwise keep showing executions from days ago.
RetentionByResult
How far back the history keeps executions with a given result, overriding Retention for that result. Empty by default.
public Dictionary<JobRunResult, TimeSpan> RetentionByResult { get; }
Property Value
Examples
options.RetentionByResult[JobRunResult.Failed] = TimeSpan.FromDays(30);
options.RetentionByResult[JobRunResult.Skipped] = TimeSpan.FromHours(1);
Remarks
Matched against EffectiveResult. Every age must be positive.
WriteBehindInterval
How long the database history buffers executions before writing them, or null, the default, to write each one as it completes.
public TimeSpan? WriteBehindInterval { get; set; }
Property Value
Remarks
Set, a completion is queued and the worker returns at once. One writer empties the queue every
interval, and sooner when a batch is full: the rows, and one QRTZ_JOB_STATUS update per job
with that job's runs folded in memory, in one transaction. A job that completes many times at once
no longer serializes on its status row.
The price: the status no longer commits with the row; a crash loses what is still buffered, normally at most one interval of rows and status changes; reads of the history and of JobRunStatus lag by up to one interval. A full queue makes a completion write itself, as with this off. A shutdown or disposal writes what is buffered first.
Read only by the database history, UsePersistentStore(store => store.UseExecutionHistory());
the in-memory history ignores it. Must be positive when set.