1
0
Fork 0
mirror of https://github.com/endofunky/sidetiq.git synced 2022-11-09 13:53:30 -05:00

Rename Sidekiq::Schedulable#tiq to #recurrence.

This commit is contained in:
Tobias Svensson 2013-07-12 10:33:57 +01:00
parent 79d5ffb13c
commit 838517d388
6 changed files with 23 additions and 11 deletions

View file

@ -1,3 +1,8 @@
0.4.0
-----
- Rename Sidekiq::Schedulable#tiq to #recurrence.
0.3.2 0.3.2
----- -----

View file

@ -71,7 +71,7 @@ class MyWorker
include Sidetiq::Schedulable include Sidetiq::Schedulable
# Daily at midnight # Daily at midnight
tiq { daily } recurrence { daily }
def perform def perform
# do stuff ... # do stuff ...
@ -86,7 +86,7 @@ class MyWorker
include Sidekiq::Worker include Sidekiq::Worker
include Sidetiq::Schedulable include Sidetiq::Schedulable
tiq do recurrence do
# Every third year in March # Every third year in March
yearly(3).month_of_year(:march) yearly(3).month_of_year(:march)
@ -108,7 +108,7 @@ class MyWorker
include Sidetiq::Schedulable include Sidetiq::Schedulable
# Every other month on the first monday and last tuesday at 12 o'clock. # Every other month on the first monday and last tuesday at 12 o'clock.
tiq { monthly(2).day_of_week(1 => [1], 2 => [-1]).hour_of_day(12) } recurrence { monthly(2).day_of_week(1 => [1], 2 => [-1]).hour_of_day(12) }
def perform def perform
# do stuff ... # do stuff ...
@ -125,7 +125,7 @@ class MyWorker
include Sidekiq::Worker include Sidekiq::Worker
include Sidetiq::Schedulable include Sidetiq::Schedulable
tiq { daily } recurrence { daily }
# Receive last and current occurrence times. # Receive last and current occurrence times.
def perform(last_occurrence, current_occurrence) def perform(last_occurrence, current_occurrence)
@ -162,7 +162,7 @@ class MyWorker
include Sidekiq::Worker include Sidekiq::Worker
include Sidetiq::Schedulable include Sidetiq::Schedulable
tiq backfill: true do recurrence backfill: true do
hourly hourly
end end
@ -285,7 +285,7 @@ class MyWorker
include Sidekiq::Worker include Sidekiq::Worker
include Sidetiq::Schedulable include Sidetiq::Schedulable
tiq { minutely(15) } recurrence { minutely(15) }
end end
``` ```
@ -296,7 +296,7 @@ class MyWorker
include Sidekiq::Worker include Sidekiq::Worker
include Sidetiq::Schedulable include Sidetiq::Schedulable
tiq { hourly.minute_of_hour(0, 15, 30, 45) } recurrence { hourly.minute_of_hour(0, 15, 30, 45) }
end end
``` ```

View file

@ -13,7 +13,7 @@ class MyWorker
include Sidekiq::Worker include Sidekiq::Worker
include Sidetiq::Schedulable include Sidetiq::Schedulable
tiq { secondly } recurrence { secondly }
def perform(*args) def perform(*args)
Sidekiq.logger.info "#perform" Sidekiq.logger.info "#perform"

View file

@ -22,7 +22,14 @@ module Sidetiq
get_timestamp "next" get_timestamp "next"
end end
def tiq(options = {}, &block) # :nodoc: def tiq(*args, &block) # :nodoc:
Sidetiq.logger.warn "DEPRECATION WARNING: Sidetiq::Schedulable#tiq" <<
" is deprecated and will be removed. Use" <<
" Sidetiq::Schedulable#recurrence instead."
recurrence(*args, &block)
end
def recurrence(options = {}, &block) # :nodoc:
clock = Sidetiq::Clock.instance clock = Sidetiq::Clock.instance
clock.synchronize do clock.synchronize do
schedule = clock.schedule_for(self) schedule = clock.schedule_for(self)

View file

@ -2,7 +2,7 @@ class BackfillWorker
include Sidekiq::Worker include Sidekiq::Worker
include Sidetiq::Schedulable include Sidetiq::Schedulable
tiq backfill: true do recurrence backfill: true do
daily daily
end end

View file

@ -2,7 +2,7 @@ class ScheduledWorker
include Sidekiq::Worker include Sidekiq::Worker
include Sidetiq::Schedulable include Sidetiq::Schedulable
tiq do recurrence do
daily.hour_of_day(1) daily.hour_of_day(1)
yearly.month_of_year(2) yearly.month_of_year(2)
monthly.day_of_month(3) monthly.day_of_month(3)