Class: SidekiqScheduler::Manager
- Inherits:
-
Object
- Object
- SidekiqScheduler::Manager
- Defined in:
- lib/sidekiq-scheduler/manager.rb
Overview
The delayed job router in the system. This manages the scheduled jobs pushed messages from Redis onto the work queues
Instance Method Summary collapse
-
#initialize(config) ⇒ Manager
constructor
A new instance of Manager.
- #start ⇒ Object
- #stop ⇒ Object
-
#to_hash ⇒ Object
This method is needed to avoid exposing unnecessary information.
Constructor Details
#initialize(config) ⇒ Manager
Returns a new instance of Manager.
11 12 13 14 15 16 17 |
# File 'lib/sidekiq-scheduler/manager.rb', line 11 def initialize(config) (config) @scheduler_instance = SidekiqScheduler::Scheduler.new(config) SidekiqScheduler::Scheduler.instance = @scheduler_instance Sidekiq.schedule = config.schedule if @scheduler_instance.enabled end |
Instance Method Details
#start ⇒ Object
23 24 25 |
# File 'lib/sidekiq-scheduler/manager.rb', line 23 def start @scheduler_instance.load_schedule! end |
#stop ⇒ Object
19 20 21 |
# File 'lib/sidekiq-scheduler/manager.rb', line 19 def stop @scheduler_instance.clear_schedule! end |
#to_hash ⇒ Object
This method is needed to avoid exposing unnecessary information. Because ActiveSupport’s ‘as_json` traverses instance values to convert the object to a hash unless it responds to `to_hash`.
30 31 32 33 34 |
# File 'lib/sidekiq-scheduler/manager.rb', line 30 def to_hash { scheduler: @scheduler_instance.to_hash } end |