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:
parent
79d5ffb13c
commit
838517d388
6 changed files with 23 additions and 11 deletions
|
@ -1,3 +1,8 @@
|
|||
0.4.0
|
||||
-----
|
||||
|
||||
- Rename Sidekiq::Schedulable#tiq to #recurrence.
|
||||
|
||||
0.3.2
|
||||
-----
|
||||
|
||||
|
|
14
README.md
14
README.md
|
@ -71,7 +71,7 @@ class MyWorker
|
|||
include Sidetiq::Schedulable
|
||||
|
||||
# Daily at midnight
|
||||
tiq { daily }
|
||||
recurrence { daily }
|
||||
|
||||
def perform
|
||||
# do stuff ...
|
||||
|
@ -86,7 +86,7 @@ class MyWorker
|
|||
include Sidekiq::Worker
|
||||
include Sidetiq::Schedulable
|
||||
|
||||
tiq do
|
||||
recurrence do
|
||||
# Every third year in March
|
||||
yearly(3).month_of_year(:march)
|
||||
|
||||
|
@ -108,7 +108,7 @@ class MyWorker
|
|||
include Sidetiq::Schedulable
|
||||
|
||||
# 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
|
||||
# do stuff ...
|
||||
|
@ -125,7 +125,7 @@ class MyWorker
|
|||
include Sidekiq::Worker
|
||||
include Sidetiq::Schedulable
|
||||
|
||||
tiq { daily }
|
||||
recurrence { daily }
|
||||
|
||||
# Receive last and current occurrence times.
|
||||
def perform(last_occurrence, current_occurrence)
|
||||
|
@ -162,7 +162,7 @@ class MyWorker
|
|||
include Sidekiq::Worker
|
||||
include Sidetiq::Schedulable
|
||||
|
||||
tiq backfill: true do
|
||||
recurrence backfill: true do
|
||||
hourly
|
||||
end
|
||||
|
||||
|
@ -285,7 +285,7 @@ class MyWorker
|
|||
include Sidekiq::Worker
|
||||
include Sidetiq::Schedulable
|
||||
|
||||
tiq { minutely(15) }
|
||||
recurrence { minutely(15) }
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -296,7 +296,7 @@ class MyWorker
|
|||
include Sidekiq::Worker
|
||||
include Sidetiq::Schedulable
|
||||
|
||||
tiq { hourly.minute_of_hour(0, 15, 30, 45) }
|
||||
recurrence { hourly.minute_of_hour(0, 15, 30, 45) }
|
||||
end
|
||||
```
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ class MyWorker
|
|||
include Sidekiq::Worker
|
||||
include Sidetiq::Schedulable
|
||||
|
||||
tiq { secondly }
|
||||
recurrence { secondly }
|
||||
|
||||
def perform(*args)
|
||||
Sidekiq.logger.info "#perform"
|
||||
|
|
|
@ -22,7 +22,14 @@ module Sidetiq
|
|||
get_timestamp "next"
|
||||
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.synchronize do
|
||||
schedule = clock.schedule_for(self)
|
||||
|
|
2
test/fixtures/backfill_worker.rb
vendored
2
test/fixtures/backfill_worker.rb
vendored
|
@ -2,7 +2,7 @@ class BackfillWorker
|
|||
include Sidekiq::Worker
|
||||
include Sidetiq::Schedulable
|
||||
|
||||
tiq backfill: true do
|
||||
recurrence backfill: true do
|
||||
daily
|
||||
end
|
||||
|
||||
|
|
2
test/fixtures/scheduled_worker.rb
vendored
2
test/fixtures/scheduled_worker.rb
vendored
|
@ -2,7 +2,7 @@ class ScheduledWorker
|
|||
include Sidekiq::Worker
|
||||
include Sidetiq::Schedulable
|
||||
|
||||
tiq do
|
||||
recurrence do
|
||||
daily.hour_of_day(1)
|
||||
yearly.month_of_year(2)
|
||||
monthly.day_of_month(3)
|
||||
|
|
Loading…
Reference in a new issue