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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e5a83c5ce92209fd4dc917cb9b85a145206047a
4
- data.tar.gz: de4d9dabfe0a6f37e8b973faa0d436cde0618c90
3
+ metadata.gz: c29c9729084c7b55ed2bed11f71f1083c88b0ba8
4
+ data.tar.gz: cbbbdd94116fffad8ec09bba65319b3499017446
5
5
  SHA512:
6
- metadata.gz: a2bdc8dd96addce81a01ea4248c1471d75ed803142edfd32f166cb2e2d4a7683b08b848ea4bd513e3520a981d8dee6cd44f73a0cdacf3310336919b02e6ae07f
7
- data.tar.gz: 4945877eb7e3c0312996d43cd447f271966d0cc97fefca9ef5ed8019d3cc587fb3ab1f8090326655be30550ff76745aca46ca682ddc65b91963ff5fd3f6d5d01
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/master'
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
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ puts "resqued-listener is deprecated and will be removed."
4
+ puts "Stop and start the master process to remove your dependence on resqued-listener."
3
5
  require 'resqued/listener'
4
6
  Resqued::Listener.exec!
data/lib/resqued.rb CHANGED
@@ -1,2 +1,6 @@
1
1
  require 'resqued/master'
2
2
  require 'resqued/version'
3
+
4
+ module Resqued
5
+ START_CTX = {}
6
+ end
@@ -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
- # This may not work in rubies earlier than 1.9.
34
- Kernel.exec('resqued-listener', socket_fd => socket_fd)
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Resqued
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
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.5.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-08 00:00:00.000000000 Z
11
+ date: 2013-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kgio