Class: KiqTock::Scheduler
- Inherits:
-
Object
- Object
- KiqTock::Scheduler
- Defined in:
- lib/kiq_tock/scheduler.rb
Constant Summary collapse
- ANY =
'*'- CRON_FIELDS =
i[minutes hours days_of_month days_of_week months_of_year].freeze
- DEFAULT_JOBS_FILE =
File. 'sidekiq/periodic_jobs.yml'
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(scheduler:, jobs_file: nil) ⇒ Scheduler
constructor
A new instance of Scheduler.
- #register_jobs ⇒ Object
Constructor Details
#initialize(scheduler:, jobs_file: nil) ⇒ Scheduler
Returns a new instance of Scheduler.
15 16 17 18 |
# File 'lib/kiq_tock/scheduler.rb', line 15 def initialize(scheduler:, jobs_file: nil) @jobs_file = jobs_file @scheduler = scheduler end |
Class Method Details
.register_jobs(scheduler:, jobs_file: nil) ⇒ Object
11 12 13 |
# File 'lib/kiq_tock/scheduler.rb', line 11 def self.register_jobs(scheduler:, jobs_file: nil) new(scheduler: scheduler, jobs_file: jobs_file).register_jobs end |
Instance Method Details
#register_jobs ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/kiq_tock/scheduler.rb', line 20 def register_jobs jobs.each do |job| scheduler.register( job[:schedule], job[:class_name], retries: job[:retry_count] ) end end |