sidetiq 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +10 -9
- data/examples/simple.rb +1 -1
- data/lib/sidetiq/schedulable.rb +8 -1
- data/lib/sidetiq/version.rb +1 -1
- data/test/fixtures/backfill_worker.rb +1 -1
- data/test/fixtures/scheduled_worker.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5176aed9abba4157c9913ff2b421ae5c355e1d3
|
4
|
+
data.tar.gz: 1a6f8f296756a2f8b86d7bd2583e95aedbf3f530
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52b4e965ffad546335b40203c8fb93be9d45659736b37e207f26a41954fb3db999b5b1bd0cd0f9b3ef06bccca8f24ffe6e772fe1ee22c441cef99697cb3086d6
|
7
|
+
data.tar.gz: 2dd87568bbda265f76e7bd061e2044b404f08242bee266ff4086fdc994c8c22ce866a4ba969bfcd34f189bd267676004517eac977a8185035d865e4690143656
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -71,7 +71,7 @@ class MyWorker
|
|
71
71
|
include Sidetiq::Schedulable
|
72
72
|
|
73
73
|
# Daily at midnight
|
74
|
-
|
74
|
+
recurrence { daily }
|
75
75
|
|
76
76
|
def perform
|
77
77
|
# do stuff ...
|
@@ -86,7 +86,7 @@ class MyWorker
|
|
86
86
|
include Sidekiq::Worker
|
87
87
|
include Sidetiq::Schedulable
|
88
88
|
|
89
|
-
|
89
|
+
recurrence do
|
90
90
|
# Every third year in March
|
91
91
|
yearly(3).month_of_year(:march)
|
92
92
|
|
@@ -108,7 +108,7 @@ class MyWorker
|
|
108
108
|
include Sidetiq::Schedulable
|
109
109
|
|
110
110
|
# Every other month on the first monday and last tuesday at 12 o'clock.
|
111
|
-
|
111
|
+
recurrence { monthly(2).day_of_week(1 => [1], 2 => [-1]).hour_of_day(12) }
|
112
112
|
|
113
113
|
def perform
|
114
114
|
# do stuff ...
|
@@ -125,7 +125,7 @@ class MyWorker
|
|
125
125
|
include Sidekiq::Worker
|
126
126
|
include Sidetiq::Schedulable
|
127
127
|
|
128
|
-
|
128
|
+
recurrence { daily }
|
129
129
|
|
130
130
|
# Receive last and current occurrence times.
|
131
131
|
def perform(last_occurrence, current_occurrence)
|
@@ -152,7 +152,7 @@ Backfills
|
|
152
152
|
|
153
153
|
In certain cases it is desirable that missed jobs will be enqueued
|
154
154
|
retroactively, for example when a critical, hourly job isn't run due to
|
155
|
-
server downtime. To solve this, `#
|
155
|
+
server downtime. To solve this, `#recurrence` takes a *backfill* option. If
|
156
156
|
missing job occurrences have been detected, Sidetiq will then enqueue
|
157
157
|
the jobs automatically. It will also ensure that the timestamps passed to
|
158
158
|
`#perform` are as expected:
|
@@ -162,7 +162,7 @@ class MyWorker
|
|
162
162
|
include Sidekiq::Worker
|
163
163
|
include Sidetiq::Schedulable
|
164
164
|
|
165
|
-
|
165
|
+
recurrence backfill: true do
|
166
166
|
hourly
|
167
167
|
end
|
168
168
|
|
@@ -219,7 +219,8 @@ Sidetiq.schedules
|
|
219
219
|
```
|
220
220
|
|
221
221
|
`Sidetiq.workers` returns an `Array` of all workers currently tracked by
|
222
|
-
Sidetiq (workers which include `Sidetiq::Schedulable` and a `.
|
222
|
+
Sidetiq (workers which include `Sidetiq::Schedulable` and a `.recurrence`
|
223
|
+
call):
|
223
224
|
|
224
225
|
```ruby
|
225
226
|
Sidetiq.workers
|
@@ -285,7 +286,7 @@ class MyWorker
|
|
285
286
|
include Sidekiq::Worker
|
286
287
|
include Sidetiq::Schedulable
|
287
288
|
|
288
|
-
|
289
|
+
recurrence { minutely(15) }
|
289
290
|
end
|
290
291
|
```
|
291
292
|
|
@@ -296,7 +297,7 @@ class MyWorker
|
|
296
297
|
include Sidekiq::Worker
|
297
298
|
include Sidetiq::Schedulable
|
298
299
|
|
299
|
-
|
300
|
+
recurrence { hourly.minute_of_hour(0, 15, 30, 45) }
|
300
301
|
end
|
301
302
|
```
|
302
303
|
|
data/examples/simple.rb
CHANGED
data/lib/sidetiq/schedulable.rb
CHANGED
@@ -22,7 +22,14 @@ module Sidetiq
|
|
22
22
|
get_timestamp "next"
|
23
23
|
end
|
24
24
|
|
25
|
-
def tiq(
|
25
|
+
def tiq(*args, &block) # :nodoc:
|
26
|
+
Sidetiq.logger.warn "DEPRECATION WARNING: Sidetiq::Schedulable#tiq" <<
|
27
|
+
" is deprecated and will be removed. Use" <<
|
28
|
+
" Sidetiq::Schedulable#recurrence instead."
|
29
|
+
recurrence(*args, &block)
|
30
|
+
end
|
31
|
+
|
32
|
+
def recurrence(options = {}, &block) # :nodoc:
|
26
33
|
clock = Sidetiq::Clock.instance
|
27
34
|
clock.synchronize do
|
28
35
|
schedule = clock.schedule_for(self)
|
data/lib/sidetiq/version.rb
CHANGED