Click or drag to resize
DelayedJobScheduler Class
Represents a background process responsible for enqueueing delayed jobs.
Inheritance Hierarchy
SystemObject
  Hangfire.ServerDelayedJobScheduler

Namespace: Hangfire.Server
Assembly: Hangfire.Core (in Hangfire.Core.dll) Version: 1.5.0.0
Syntax
public class DelayedJobScheduler : IBackgroundProcess

The DelayedJobScheduler type exposes the following members.

Constructors
  NameDescription
Public methodDelayedJobScheduler
Initializes a new instance of the DelayedJobScheduler class with the DefaultPollingDelay value as a delay between runs.
Public methodDelayedJobScheduler(TimeSpan)
Initializes a new instance of the DelayedJobScheduler class with a specified polling interval.
Public methodDelayedJobScheduler(TimeSpan, IBackgroundJobStateChanger)
Initializes a new instance of the DelayedJobScheduler class with a specified polling interval and given state changer.
Top
Methods
Fields
  NameDescription
Public fieldStatic memberDefaultPollingDelay
Represents a default polling interval for delayed job scheduler. This field is read-only.
Top
Remarks

This background process polls the delayed job schedule for delayed jobs that are ready to be enqueued. To prevent a stress load on a job storage, the configurable delay is used between scheduler runs. Delay is used only when there are no more background jobs to be enqueued.

When a background job is ready to be enqueued, it is simply moved from ScheduledState to the EnqueuedState by using IBackgroundJobStateChanger.

Delayed job schedule is based on a Set data structure of a job storage, so you can use this background process as an example of a custom extension.

Multiple instances of this background process can be used in separate threads/processes without additional configuration (distributed locks are used). However, this only adds support for fail-over, and does not increase the performance.

Important note Important
If you are using custom filter providers, you need to pass a custom IBackgroundJobStateChanger instance to make this process respect your filters when enqueueing background jobs.
Thread Safety
Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.
See Also