resqued 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/resqued +8 -1
- data/exe/resqued-listener +2 -0
- data/lib/resqued.rb +4 -0
- data/lib/resqued/listener.rb +5 -3
- data/lib/resqued/master.rb +10 -2
- data/lib/resqued/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c29c9729084c7b55ed2bed11f71f1083c88b0ba8
|
4
|
+
data.tar.gz: cbbbdd94116fffad8ec09bba65319b3499017446
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0984ea77d172f109264c8b8a34fe0997f7ab4ec19293cec77588c5ccf918752524cbec37c6bd9dac93462d84c75b3a86873cce7b9dd4cd1e3790ee4e88867356
|
7
|
+
data.tar.gz: 88484776caa1bf5faf77281f9f9c55d111e96eb955f1293b94c2f801b19203fe509be1b5d86a57948ded1e7282660df94f1169c7a908001a31f1da661ab0e03b
|
data/exe/resqued
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
if ARGV == ['listener']
|
4
|
+
require 'resqued/listener'
|
5
|
+
Resqued::Listener.exec!
|
6
|
+
exit 0
|
7
|
+
end
|
8
|
+
|
3
9
|
require 'optparse'
|
4
10
|
|
5
11
|
options = {}
|
@@ -54,7 +60,8 @@ if test
|
|
54
60
|
puts "#{index + 1}: #{worker.queues.join(',')}"
|
55
61
|
end
|
56
62
|
else
|
57
|
-
require 'resqued
|
63
|
+
require 'resqued'
|
64
|
+
Resqued::START_CTX['$0'] = $0.dup
|
58
65
|
resqued = Resqued::Master.new(options)
|
59
66
|
if daemonize
|
60
67
|
require 'resqued/daemon'
|
data/exe/resqued-listener
CHANGED
data/lib/resqued.rb
CHANGED
data/lib/resqued/listener.rb
CHANGED
@@ -30,8 +30,8 @@ module Resqued
|
|
30
30
|
ENV['RESQUED_CONFIG_PATH'] = @config_paths.join(':')
|
31
31
|
ENV['RESQUED_STATE'] = (@running_workers.map { |r| "#{r[:pid]}|#{r[:queue]}" }.join('||'))
|
32
32
|
ENV['RESQUED_LISTENER_ID'] = @listener_id.to_s
|
33
|
-
|
34
|
-
Kernel.exec('
|
33
|
+
log "exec: #{Resqued::START_CTX['$0']} listener"
|
34
|
+
Kernel.exec(Resqued::START_CTX['$0'], 'listener', socket_fd => socket_fd) # The hash at the end only works in new-ish (1.9+ or so) rubies. It's required for ruby 2.0.
|
35
35
|
end
|
36
36
|
|
37
37
|
# Public: Given args from #exec, start this listener.
|
@@ -52,7 +52,7 @@ module Resqued
|
|
52
52
|
new(options).run
|
53
53
|
end
|
54
54
|
|
55
|
-
SIGNALS = [ :QUIT, :INT, :TERM ]
|
55
|
+
SIGNALS = [ :CONT, :QUIT, :INT, :TERM ]
|
56
56
|
|
57
57
|
SIGNAL_QUEUE = []
|
58
58
|
|
@@ -83,6 +83,8 @@ module Resqued
|
|
83
83
|
case signal = SIGNAL_QUEUE.shift
|
84
84
|
when nil
|
85
85
|
yawn
|
86
|
+
when :CONT
|
87
|
+
kill_all(signal)
|
86
88
|
when :QUIT, :INT, :TERM
|
87
89
|
return signal
|
88
90
|
end
|
data/lib/resqued/master.rb
CHANGED
@@ -41,7 +41,7 @@ module Resqued
|
|
41
41
|
loop do
|
42
42
|
read_listeners
|
43
43
|
reap_all_listeners(Process::WNOHANG)
|
44
|
-
start_listener
|
44
|
+
start_listener unless @paused
|
45
45
|
case signal = SIGNAL_QUEUE.shift
|
46
46
|
when nil
|
47
47
|
yawn(@listener_backoff.how_long? || 30.0)
|
@@ -51,6 +51,14 @@ module Resqued
|
|
51
51
|
reopen_logs
|
52
52
|
log "Restarting listener with new configuration and application."
|
53
53
|
kill_listener(:QUIT)
|
54
|
+
when :USR2
|
55
|
+
log "Pause job processing"
|
56
|
+
@paused = true
|
57
|
+
kill_listener(:QUIT)
|
58
|
+
when :CONT
|
59
|
+
log "Resume job processing"
|
60
|
+
@paused = false
|
61
|
+
kill_all_listeners(:CONT)
|
54
62
|
when :INT, :TERM, :QUIT
|
55
63
|
log "Shutting down..."
|
56
64
|
kill_all_listeners(signal)
|
@@ -158,7 +166,7 @@ module Resqued
|
|
158
166
|
end while true
|
159
167
|
end
|
160
168
|
|
161
|
-
SIGNALS = [ :HUP, :INT, :TERM, :QUIT ]
|
169
|
+
SIGNALS = [ :HUP, :INT, :USR2, :CONT, :TERM, :QUIT ]
|
162
170
|
OPTIONAL_SIGNALS = [ :INFO ]
|
163
171
|
OTHER_SIGNALS = [:CHLD, 'EXIT']
|
164
172
|
TRAPS = SIGNALS + OPTIONAL_SIGNALS + OTHER_SIGNALS
|
data/lib/resqued/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resqued
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Burke
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kgio
|