Class: Sidekiq::Cron::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/cron.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



45
46
47
48
49
50
51
52
# 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

Instance Attribute Details

#cron_history_sizeObject

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



26
27
28
# File 'lib/sidekiq/cron.rb', line 26

def cron_history_size
  @cron_history_size
end

#cron_poll_intervalObject

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



19
20
21
# File 'lib/sidekiq/cron.rb', line 19

def cron_poll_interval
  @cron_poll_interval
end

#cron_schedule_fileObject

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



22
23
24
# File 'lib/sidekiq/cron.rb', line 22

def cron_schedule_file
  @cron_schedule_file
end

#default_namespaceObject

The default namespace is used when no namespace is specified.



29
30
31
# File 'lib/sidekiq/cron.rb', line 29

def default_namespace
  @default_namespace
end

#natural_cron_parsing_modeObject

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



35
36
37
# File 'lib/sidekiq/cron.rb', line 35

def natural_cron_parsing_mode
  @natural_cron_parsing_mode
end

#reschedule_grace_periodObject

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.



43
44
45
# File 'lib/sidekiq/cron.rb', line 43

def reschedule_grace_period
  @reschedule_grace_period
end