class Sidekiq::Cron::Configuration

Attributes

cron_history_size[RW]

The maximum number of recent cron job execution histories to retain. This value controls how many past job executions are stored.

cron_poll_interval[RW]

The interval, in seconds, at which to poll for scheduled cron jobs. This determines how frequently the scheduler checks for jobs to enqueue.

cron_schedule_file[RW]

The path to a YAML file containing multiple cron job schedules.

default_namespace[RW]

The default namespace is used when no namespace is specified.

natural_cron_parsing_mode[R]

The parsing mode when using the natural language cron syntax from the ‘fugit` gem.

:single – use the first parsed cron line and ignore the rest (default) :strict – raise an error if multiple cron lines are parsed from one string

reschedule_grace_period[RW]

The poller will not enqueue jobs that are late by more than this amount of seconds. Defaults to 60 seconds.

This is useful when Sidekiq (and Sidekiq-Cron) is not used in zero downtime deployments and when the deployment is done and Sidekiq-Cron starts to catch up, it will consider older jobs that missed their schedules during the deployment. E.g., jobs that run once a day.

Public Class Methods

new() click to toggle source
# File lib/sidekiq/cron.rb, line 45
def initialize
  @cron_poll_interval = 30
  @cron_schedule_file = 'config/schedule.yml'
  @cron_history_size = 10
  @default_namespace = 'default'
  @natural_cron_parsing_mode = :single
  @reschedule_grace_period = 60
end

Public Instance Methods

natural_cron_parsing_mode=(mode) click to toggle source
# File lib/sidekiq/cron.rb, line 54
def natural_cron_parsing_mode=(mode)
  unless %i[single strict].include?(mode)
    raise ArgumentError, "Unknown natural cron parsing mode: #{mode.inspect}"
  end

  @natural_cron_parsing_mode = mode
end