Table of Contents

Struct SchedulerRestartOptions

Namespace
Quartz
Assembly
Quartz.dll

How long a restart waits for the outgoing scheduler's work, and what it leaves the new one doing.

public readonly record struct SchedulerRestartOptions : IEquatable<SchedulerRestartOptions>
Implements
Inherited Members

Remarks

Two settings, and both defaults say "as it was": wait long enough for a job to finish but not indefinitely, and leave the new scheduler running exactly if the old one was. So default — which is what omitting the argument gives — is a restart that changes nothing but the instances.

There is no WaitForJobsToComplete. A restart always waits, because the next generation's first act is a recovery sweep over the whole scheduler name — it moves acquired and blocked triggers back to waiting and deletes every fired-trigger row — and running that while the previous generation's jobs are still writing would corrupt them. DrainTimeout is how long that wait may take, and giving up on it fails the restart rather than proceeding.

Properties

DrainTimeout

How long to wait for the outgoing scheduler's running jobs before giving up on the restart.

public TimeSpan? DrainTimeout { get; init; }

Property Value

TimeSpan?

Remarks

null — the default — is thirty seconds. InfiniteTimeSpan waits until the jobs finish or the cancellation token fires, whichever comes first. The wait covers each job's job store update as well as the job itself, because the thread pool is handed the whole of an execution and that update is its last act.

A wait that expires leaves the old scheduler shut down and the new one unbuilt, and reports a SchedulerRestartException. Ask again once the work has finished — nothing else is needed, and until then the name is listed with no status. Long-running jobs that must be cut short are what ShutdownJobInterruption and JobTimeoutAttribute are for.

Start

Whether the new scheduler is started.

public bool? Start { get; init; }

Property Value

bool?

Remarks

null — the default — starts it if the old one was running, and leaves it created if the old one was in standby, had never been started, or had already been shut down. A restart that changed whether a scheduler fires would be a second decision hidden inside the first. Say true or false to decide it deliberately.

WithoutStarting

Leave the new scheduler for the application to start, whatever the old one was doing. The name for new SchedulerRestartOptions { Start = false }.

public static SchedulerRestartOptions WithoutStarting { get; }

Property Value

SchedulerRestartOptions

See Also