Module: Sidetiq::Schedulable::ClassMethods
- Includes:
- Sidetiq::SubclassTracking
- Defined in:
- lib/sidetiq/schedulable.rb
Instance Attribute Summary collapse
-
#schedule ⇒ Object
Public: Returns the Sidetiq::Schedule for this worker.
Instance Method Summary collapse
-
#last_scheduled_occurrence ⇒ Object
Public: Returns a Float timestamp of the last scheduled run.
-
#next_scheduled_occurrence ⇒ Object
Public: Returns a Float timestamp of the next scheduled run.
-
#recurrence(options = {}, &block) ⇒ Object
:nodoc:.
- #schedule_description ⇒ Object
Methods included from Sidetiq::SubclassTracking
Instance Attribute Details
Instance Method Details
#last_scheduled_occurrence ⇒ Object
Public: Returns a Float timestamp of the last scheduled run.
22 23 24 |
# File 'lib/sidetiq/schedulable.rb', line 22 def last_scheduled_occurrence "last" end |
#next_scheduled_occurrence ⇒ Object
Public: Returns a Float timestamp of the next scheduled run.
32 33 34 |
# File 'lib/sidetiq/schedulable.rb', line 32 def next_scheduled_occurrence "next" end |
#recurrence(options = {}, &block) ⇒ Object
:nodoc:
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/sidetiq/schedulable.rb', line 40 def recurrence( = {}, &block) # :nodoc: schedule.instance_eval(&block) schedule.() # deleting schedulable keys if schedule changed since last reccurence definition if Sidekiq.server? old_description = get_schedulable_key("schedule_description") if old_description != schedule.to_s get_schedulable_keys.map do |key| Sidekiq.redis_pool.with { |r| r.del(key) } end set_schedulable_key("schedule_description", schedule.to_s) end end end |
#schedule_description ⇒ Object
36 37 38 |
# File 'lib/sidetiq/schedulable.rb', line 36 def schedule_description get_schedulable_key("schedule_description") end |