resque-scheduler 2.5.0 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of resque-scheduler might be problematic. Click here for more details.
- data/.rubocop.yml +1 -1
- data/HISTORY.md +3 -0
- data/lib/resque/scheduler.rb +38 -22
- data/lib/resque_scheduler/version.rb +1 -1
- metadata +3 -3
data/.rubocop.yml
CHANGED
data/HISTORY.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Resque Scheduler History / ChangeLog / Release Notes
|
2
2
|
|
3
|
+
## 2.5.1 (2014-02-09)
|
4
|
+
* Make signal handling (really) Ruby 2 compatible
|
5
|
+
|
3
6
|
## 2.5.0 (2014-02-09)
|
4
7
|
* Use `logger.error` when logging errors from `handle_errors`
|
5
8
|
* Added search feature to the Delayed tab in Resque Web
|
data/lib/resque/scheduler.rb
CHANGED
@@ -12,6 +12,12 @@ module Resque
|
|
12
12
|
yield self
|
13
13
|
end
|
14
14
|
|
15
|
+
attr_writer :signal_queue
|
16
|
+
|
17
|
+
def signal_queue
|
18
|
+
@signal_queue ||= []
|
19
|
+
end
|
20
|
+
|
15
21
|
# Used in `#load_schedule_job`
|
16
22
|
attr_writer :env
|
17
23
|
|
@@ -110,37 +116,47 @@ module Resque
|
|
110
116
|
load_schedule!
|
111
117
|
end
|
112
118
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
119
|
+
begin
|
120
|
+
@th = Thread.current
|
121
|
+
|
122
|
+
# Now start the scheduling part of the loop.
|
123
|
+
loop do
|
124
|
+
if is_master?
|
125
|
+
begin
|
126
|
+
handle_delayed_items
|
127
|
+
update_schedule if dynamic
|
128
|
+
rescue Errno::EAGAIN, Errno::ECONNRESET => e
|
129
|
+
log! e.message
|
130
|
+
end
|
123
131
|
end
|
132
|
+
handle_signals
|
133
|
+
poll_sleep
|
124
134
|
end
|
125
|
-
poll_sleep
|
126
|
-
end
|
127
135
|
|
128
|
-
|
136
|
+
rescue Interrupt
|
137
|
+
log 'Exiting'
|
138
|
+
end
|
129
139
|
end
|
130
140
|
|
131
141
|
# For all signals, set the shutdown flag and wait for current
|
132
|
-
# poll/enqueing to finish (should be almost
|
142
|
+
# poll/enqueing to finish (should be almost instant). In the
|
133
143
|
# case of sleeping, exit immediately.
|
134
144
|
def register_signal_handlers
|
135
|
-
|
136
|
-
|
145
|
+
%w(INT TERM USR1 USR2 QUIT).each do |sig|
|
146
|
+
trap(sig) { signal_queue << sig }
|
147
|
+
end
|
148
|
+
end
|
137
149
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
150
|
+
def handle_signals
|
151
|
+
loop do
|
152
|
+
sig = signal_queue.shift
|
153
|
+
break unless sig
|
154
|
+
log! "Got #{sig} signal"
|
155
|
+
case sig
|
156
|
+
when 'INT', 'TERM', 'QUIT' then shutdown
|
157
|
+
when 'USR1' then print_schedule
|
158
|
+
when 'USR2' then reload_schedule!
|
159
|
+
end
|
144
160
|
end
|
145
161
|
end
|
146
162
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -256,7 +256,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
256
256
|
version: '0'
|
257
257
|
segments:
|
258
258
|
- 0
|
259
|
-
hash:
|
259
|
+
hash: 322946193888526441
|
260
260
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
261
261
|
none: false
|
262
262
|
requirements:
|
@@ -265,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
265
|
version: '0'
|
266
266
|
segments:
|
267
267
|
- 0
|
268
|
-
hash:
|
268
|
+
hash: 322946193888526441
|
269
269
|
requirements: []
|
270
270
|
rubyforge_project:
|
271
271
|
rubygems_version: 1.8.23
|