sidekiq-scheduler 2.0.7 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d0589167bd1d704cc531881f41ce934e07e684a
4
- data.tar.gz: 4a07798d84026cedbb746d6c455463ae796ca56f
3
+ metadata.gz: a2ca5f12c843c8653e3a174431625f89622daee3
4
+ data.tar.gz: e479e32ea285d53200078971da9b1eb3e7dfd323
5
5
  SHA512:
6
- metadata.gz: 56218d97eb155af5fbf07e4ccbca6a5e76bfe5e23facefb8e685758d3f031b17ab6f66ed89132a8953a8b03ad3935132cb1eefedbf3adbb2d23168698c4b959a
7
- data.tar.gz: 722247865b66c237efcea76d099207b746e5058adeb60a550a8090baec5c666dab01f7659a8c00d3021fa9138692eccde02b62343980b3da2f9cfab5b2d4a0de
6
+ metadata.gz: 2ab648c207104060b36cfebb38fae68bb8af05b63ab2760485d6b958e1145312b7b1ceca631089eb297d8a84f6963969920e04f36e5fc9f641f45635b58d5c10
7
+ data.tar.gz: ef5e376ba307b8b0fc62c6fcb61b7be50c50cd37971715e501de8220dad7e8743dfb5856ba18c10aa963c990827d194b807df2fe45927a38c3027aa7310a247b
data/README.md CHANGED
@@ -25,45 +25,49 @@
25
25
  </a>
26
26
  </p>
27
27
 
28
- sidekiq-scheduler is an extension to [Sidekiq](http://github.com/mperham/sidekiq)
29
- that adds support for running scheduled.
30
-
31
- Scheduled jobs are like cron jobs, recurring on a regular basis.
28
+ sidekiq-scheduler is an extension to [Sidekiq](http://github.com/mperham/sidekiq) that adds support
29
+ for running scheduled jobs, which are like cron jobs, recurring on a regular basis.
32
30
 
33
31
  ## Installation
34
32
 
35
33
  Add this to your Gemfile:
34
+
36
35
  ```ruby
37
36
  gem 'sidekiq-scheduler', '~> 2.0'
38
- ```
37
+ ```
39
38
 
40
- If you are using rails you are set
39
+ If you are using Rails you are set.
40
+
41
+ If you are not using Rails create a file with this content:
41
42
 
42
- If you are not using rails create a file with this content:
43
43
  ```ruby
44
44
  require 'sidekiq-scheduler'
45
- ```
45
+ ```
46
+
47
+ and then execute:
46
48
 
47
- and the execute:
48
49
  ```sh
49
50
  sidekiq -r created_file_path.rb
50
- ```
51
+ ```
51
52
 
52
53
  Look at [Loading the schedule](https://github.com/moove-it/sidekiq-scheduler/#loading-the-schedule)
53
54
  for information on how to load your schedule.
54
55
 
55
- You can add sidekiq-scheduler configuration options to sidekiq.yml config file.
56
+ You can add sidekiq-scheduler configuration options to `sidekiq.yml` config file.
56
57
  Available options are:
57
58
 
58
- :schedule: <the schedule to be run>
59
- :dynamic: <if true the schedule can be modified in runtime [false by default]>
60
- :enabled: <enables scheduler if true [true by default]>
61
- :scheduler:
62
- :listened_queues_only: <push jobs whose queue is being listened by sidekiq [false by default]>
59
+ ``` yaml
60
+ :schedule: <the schedule to be run>
61
+ :dynamic: <if true the schedule can be modified in runtime [false by default]>
62
+ :enabled: <enables scheduler if true [true by default]>
63
+ :scheduler:
64
+ :listened_queues_only: <push jobs whose queue is being listened by sidekiq [false by default]>
65
+ ```
63
66
 
64
67
  ## Manage tasks from Unicorn/Rails server
65
68
 
66
- For example, if you want start sidekiq-scheduler only from Unicorn/Rails, but not from Sidekiq you can write something like this in initializer:
69
+ If you want start sidekiq-scheduler only from Unicorn/Rails, but not from Sidekiq you can have
70
+ something like this in an initializer:
67
71
 
68
72
  ```ruby
69
73
  # config/initializers/sidekiq_scheduler.rb
@@ -91,46 +95,52 @@ end
91
95
  ## Scheduled Jobs (Recurring Jobs)
92
96
 
93
97
  Scheduled (or recurring) jobs are logically no different than a standard cron
94
- job. They are jobs that run based on a fixed schedule which is set at
98
+ job. They are jobs that run based on a fixed schedule which is set at
95
99
  startup.
96
100
 
97
101
  The schedule is a list of Sidekiq worker classes with arguments and a
98
- schedule frequency (in crontab syntax). The schedule is just a hash, but
99
- is most likely stored in a YAML like so:
100
-
101
- CancelAbandonedOrders:
102
- cron: "*/5 * * * *"
103
-
104
- queue_documents_for_indexing:
105
- cron: "0 0 * * *"
106
- # you can use rufus-scheduler "every" syntax in place of cron if you prefer
107
- # every: 1h
108
- # By default the job name (hash key) will be taken as worker class name.
109
- # If you want to have a different job name and class name, provide the 'class' option
110
- class: QueueDocuments
111
- queue: high
112
- args:
113
- description: "This job queues all content for indexing in solr"
114
-
115
- clear_leaderboards_contributors:
116
- cron: "30 6 * * 1"
117
- class: ClearLeaderboards
118
- queue: low
119
- args: contributors
120
- description: "This job resets the weekly leaderboard for contributions"
121
-
122
- You can provide options to "every" or "cron" via Array:
123
-
124
- clear_leaderboards_moderator:
125
- every: ["30s", :first_in => '120s']
126
- class: CheckDaemon
127
- queue: daemons
128
- description: "This job will check Daemon every 30 seconds after 120 seconds after start"
102
+ schedule frequency (in crontab syntax). The schedule is just a Hash, being most likely
103
+ stored in a YAML like so:
104
+
105
+ ``` yaml
106
+ CancelAbandonedOrders:
107
+ cron: "*/5 * * * *"
108
+
109
+ queue_documents_for_indexing:
110
+ cron: "0 0 * * *"
111
+ # you can use rufus-scheduler "every" syntax in place of cron if you prefer
112
+ # every: 1h
113
+
114
+ # By default the job name (Hash key) will be taken as worker class name.
115
+ # If you want to have a different job name and class name, provide the 'class' option
116
+ class: QueueDocuments
117
+
118
+ queue: high
119
+ args:
120
+ description: "This job queues all content for indexing in solr"
121
+
122
+ clear_leaderboards_contributors:
123
+ cron: "30 6 * * 1"
124
+ class: ClearLeaderboards
125
+ queue: low
126
+ args: contributors
127
+ description: "This job resets the weekly leaderboard for contributions"
128
+ ```
129
+
130
+ You can provide options to `every` or `cron` via an Array:
131
+
132
+ ``` yaml
133
+ clear_leaderboards_moderator:
134
+ every: ["30s", :first_in => '120s']
135
+ class: CheckDaemon
136
+ queue: daemons
137
+ description: "This job will check Daemon every 30 seconds after 120 seconds after start"
138
+ ```
129
139
 
130
140
 
131
141
  NOTE: Six parameter cron's are also supported (as they supported by
132
142
  rufus-scheduler which powers the sidekiq-scheduler process). This allows you
133
- to schedule jobs per second (ie: "30 * * * * *" would fire a job every 30
143
+ to schedule jobs per second (ie: `30 * * * * *` would fire a job every 30
134
144
  seconds past the minute).
135
145
 
136
146
  A big shout out to [rufus-scheduler](http://github.com/jmettraux/rufus-scheduler)
@@ -139,8 +149,8 @@ for handling the heavy lifting of the actual scheduling engine.
139
149
 
140
150
  ### Loading the schedule
141
151
 
142
- Let's assume your scheduled jobs are defined in a file called "config/scheduler.yml" under your Rails project,
143
- you could create a Rails initializer called "config/initializers/scheduler.rb" which would load the job definitions:
152
+ Let's assume your scheduled jobs are defined in a file called `config/scheduler.yml` under your Rails project,
153
+ you could create a Rails initializer called `config/initializers/scheduler.rb` which would load the job definitions:
144
154
 
145
155
  ```ruby
146
156
  require 'sidekiq/scheduler'
@@ -153,7 +163,7 @@ Sidekiq.configure_server do |config|
153
163
  end
154
164
  ```
155
165
 
156
- If you were running a non Rails project you should add code to load the workers classes before loading the schedule.
166
+ If you are running a non Rails project you should add code to load the workers classes before loading the schedule.
157
167
 
158
168
  ```ruby
159
169
  require 'sidekiq/scheduler'
@@ -197,12 +207,14 @@ When `:dynamic` flag is set to `true`, schedule changes are loaded every 5 secon
197
207
 
198
208
  You can set that flag in the following ways.
199
209
 
200
- - Yaml configuration:
210
+ - YAML configuration:
211
+
201
212
  ```
202
213
  :dynamic: true
203
214
  ```
204
215
 
205
216
  - Initializer configuration:
217
+
206
218
  ```ruby
207
219
  Sidekiq.configure_server do |config|
208
220
  # ...
@@ -216,25 +228,30 @@ end
216
228
 
217
229
  If `:dynamic` flag is set to false, you have to reload the schedule manually in sidekiq
218
230
  side:
231
+
219
232
  ```ruby
220
233
  Sidekiq::Scheduler.reload_schedule!
221
234
  ```
222
235
 
223
- If the schedule did not exist it'll we created, if it existed it'll be updated
236
+ If the schedule did not exist it will we created, if it existed it will be updated.
224
237
 
225
238
  ### Testing
226
239
 
227
- In your tests you can check that a schedule change has been set you have to:
228
- ```ruby
229
- require 'sidekiq'
230
- require 'sidekiq-scheduler'
231
- require 'sidekiq-scheduler/test'
240
+ In your tests you can check that a schedule change has been set you have to:
232
241
 
233
- Sidekiq.set_schedule('some_name', { 'every' => ['1m'], 'class' => 'HardWorker' })
242
+ ```ruby
243
+ require 'sidekiq'
244
+ require 'sidekiq-scheduler'
245
+ require 'sidekiq-scheduler/test'
234
246
 
235
- Sidekiq::Scheduler.schedules => { 'every' => ['1m'], 'class' => 'HardWorker' }
236
- Sidekiq::Scheduler.schedules_changed => ['every']
237
- ```
247
+ Sidekiq.set_schedule('some_name', { 'every' => ['1m'], 'class' => 'HardWorker' })
248
+
249
+ Sidekiq::Scheduler.schedules
250
+ # => { 'every' => ['1m'], 'class' => 'HardWorker' }
251
+
252
+ Sidekiq::Scheduler.schedules_changed
253
+ # => ['every']
254
+ ```
238
255
 
239
256
 
240
257
  ### Time zones
@@ -244,13 +261,17 @@ rather than the `config.time_zone` specified in Rails.
244
261
 
245
262
  You can explicitly specify the time zone that rufus-scheduler will use:
246
263
 
247
- cron: "30 6 * * 1 Europe/Stockholm"
264
+ ``` yaml
265
+ cron: "30 6 * * 1 Europe/Stockholm"
266
+ ```
248
267
 
249
268
  Also note that `config.time_zone` in Rails allows for a shorthand (e.g. "Stockholm")
250
269
  that rufus-scheduler does not accept. If you write code to set the scheduler time zone
251
270
  from the `config.time_zone` value, make sure it's the right format, e.g. with:
252
271
 
253
- ActiveSupport::TimeZone.find_tzinfo(Rails.configuration.time_zone).name
272
+ ``` ruby
273
+ ActiveSupport::TimeZone.find_tzinfo(Rails.configuration.time_zone).name
274
+ ```
254
275
 
255
276
  A future version of sidekiq-scheduler may do this for you.
256
277
 
@@ -258,7 +279,7 @@ A future version of sidekiq-scheduler may do this for you.
258
279
 
259
280
  SidekiqScheduler provides an extension to the Sidekiq web interface that adds a Recurring Jobs page.
260
281
 
261
- To use it, set up the Sidekiq web interface according to the Sidekiq documentation and then add the SidekiqScheduler::Web require:
282
+ To use it, set up the Sidekiq web interface according to the Sidekiq documentation and then add the `sidekiq-scheduler/web` require:
262
283
 
263
284
  ``` ruby
264
285
  require 'sidekiq/web'
@@ -269,10 +290,10 @@ require 'sidekiq-scheduler/web'
269
290
 
270
291
  * Fork the project.
271
292
  * Make your feature addition or bug fix.
272
- * Add tests for it. This is important so I don't break it in a future version unintentionally.
273
- * Commit, do not mess with rakefile, version, or history.
274
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
275
- * Send me a pull request. Bonus points for topic branches.
293
+ * Add tests for it. This is important so it won't break it in a future version unintentionally.
294
+ * Commit, do not mess with version, or history.
295
+ (if you want to have your own version, that is fine but bump version in a commit by itself so it can be ignored when merging)
296
+ * Send a pull request. Bonus points for topic branches.
276
297
 
277
298
  ## Credits
278
299
 
@@ -1,5 +1,5 @@
1
1
  module SidekiqScheduler
2
2
 
3
- VERSION = '2.0.7'
3
+ VERSION = '2.0.8'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.7
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morton Jonuschat
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-20 00:00:00.000000000 Z
12
+ date: 2016-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq
@@ -169,16 +169,16 @@ dependencies:
169
169
  name: activejob
170
170
  requirement: !ruby/object:Gem::Requirement
171
171
  requirements:
172
- - - ">="
172
+ - - "<"
173
173
  - !ruby/object:Gem::Version
174
- version: '0'
174
+ version: '5'
175
175
  type: :development
176
176
  prerelease: false
177
177
  version_requirements: !ruby/object:Gem::Requirement
178
178
  requirements:
179
- - - ">="
179
+ - - "<"
180
180
  - !ruby/object:Gem::Version
181
- version: '0'
181
+ version: '5'
182
182
  - !ruby/object:Gem::Dependency
183
183
  name: coveralls
184
184
  requirement: !ruby/object:Gem::Requirement