From 838517d3888c317eba24bd300ced44a89a8ee110 Mon Sep 17 00:00:00 2001 From: Tobias Svensson Date: Fri, 12 Jul 2013 10:33:57 +0100 Subject: [PATCH] Rename Sidekiq::Schedulable#tiq to #recurrence. --- CHANGELOG.md | 5 +++++ README.md | 14 +++++++------- examples/simple.rb | 2 +- lib/sidetiq/schedulable.rb | 9 ++++++++- test/fixtures/backfill_worker.rb | 2 +- test/fixtures/scheduled_worker.rb | 2 +- 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dc0352..74bb7dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +0.4.0 +----- + +- Rename Sidekiq::Schedulable#tiq to #recurrence. + 0.3.2 ----- diff --git a/README.md b/README.md index 1fb5e50..da9e262 100644 --- a/README.md +++ b/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 ``` diff --git a/examples/simple.rb b/examples/simple.rb index b4ea2aa..261d65a 100644 --- a/examples/simple.rb +++ b/examples/simple.rb @@ -13,7 +13,7 @@ class MyWorker include Sidekiq::Worker include Sidetiq::Schedulable - tiq { secondly } + recurrence { secondly } def perform(*args) Sidekiq.logger.info "#perform" diff --git a/lib/sidetiq/schedulable.rb b/lib/sidetiq/schedulable.rb index eb9f60a..beae790 100644 --- a/lib/sidetiq/schedulable.rb +++ b/lib/sidetiq/schedulable.rb @@ -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) diff --git a/test/fixtures/backfill_worker.rb b/test/fixtures/backfill_worker.rb index 2aef8a9..c649e0c 100644 --- a/test/fixtures/backfill_worker.rb +++ b/test/fixtures/backfill_worker.rb @@ -2,7 +2,7 @@ class BackfillWorker include Sidekiq::Worker include Sidetiq::Schedulable - tiq backfill: true do + recurrence backfill: true do daily end diff --git a/test/fixtures/scheduled_worker.rb b/test/fixtures/scheduled_worker.rb index 83ca320..d4a4371 100644 --- a/test/fixtures/scheduled_worker.rb +++ b/test/fixtures/scheduled_worker.rb @@ -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)