resqued 0.8.2 → 0.8.3

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: d676781c710a5929a262528a3069776cb67a4a71
4
- data.tar.gz: 4a3f3696df1f647046be37c7d0bd3dc47de0206b
3
+ metadata.gz: 06883e41037ccd453274da0f9e3727fcbcb6801c
4
+ data.tar.gz: 2f63d5e0ee2b1c2189edfdf5985438608e061d6d
5
5
  SHA512:
6
- metadata.gz: f379966b96f5f6eb0351bb67c32b1b260333b52868a401f058b7ae011155675193d4b41cf5adb9aea007d8e1f38aa328bacd6378fb133e6662952afda5f7b349
7
- data.tar.gz: d7ba90498260585f55791551f38d6701d834d85a15893463c71954876c23d5c2d22c5258f1004ac51dd6b26e234d7ba002c09b93d7d887189fbe461a7756ea86
6
+ metadata.gz: caf06d5cba99ab3bf12c0f699efd72ac896e75bbf14a4e4a6a58c6068d0666f03aad0e12c8aa4b1c837309d419d6144e3b77d2ba4c648719327d03bf42b8253c
7
+ data.tar.gz: 4790df77dc5cd23349e3576693345b26251c7432d83d307370e1ecfcaa1a811cd570ee30843e801e85c5addf4656a906c4a44b381f7aeb848e56b3030aace183
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  Starting with version 0.6.1, resqued uses semantic versioning to indicate incompatibilities between the master process, listener process, and configuration.
2
2
 
3
+ v0.8.3
4
+ ------
5
+ * Add a "fast-exit" mode (#44)
6
+
3
7
  v0.8.2
4
8
  ------
5
9
  * Detach more completely (#43)
@@ -24,8 +24,8 @@ The Master process handles several signals.
24
24
 
25
25
  * `HUP`: Start a new listener. After it boots, kill the previous listener with `SIGQUIT`.
26
26
  * `USR2`: Pause processing. Kills the current listener, and does not start a replacement.
27
- * `CONT`: Resume processing. If there is no listener, start one. If there is a listener, send it SIGCONT.
28
- * `QUIT`, `INT`, or `TERM`: Kill the listener with the same signal and wait for it to exit.
27
+ * `CONT`: Resume processing. If there is no listener, start one. If there is a listener, send it `SIGCONT`.
28
+ * `QUIT`, `INT`, or `TERM`: Kill the listener with the same signal and wait for it to exit. If `--fast-exit` was specified, the master exits immediately without waiting for the listener to exit.
29
29
  * `CHLD`: Clean up any listeners that have exited. If the current listener exited
30
30
 
31
31
  ## Listener
@@ -30,6 +30,10 @@ opts = OptionParser.new do |opts|
30
30
  test = true
31
31
  end
32
32
 
33
+ opts.on '--fast-exit', 'Exit quickly on SIGQUIT, SIGTERM' do
34
+ options[:fast_exit] = true
35
+ end
36
+
33
37
  opts.on '-p', '--pidfile PIDFILE', 'Store the pid of the master process in PIDFILE' do |v|
34
38
  options[:master_pidfile] = v
35
39
  end
@@ -186,13 +186,15 @@ module Resqued
186
186
 
187
187
  # Private: Check if master reports any dead workers.
188
188
  def check_for_expired_workers
189
+ return unless @socket
189
190
  loop do
190
191
  IO.select([@socket], nil, nil, 0) or return
191
192
  line = @socket.readline
192
193
  finish_worker(line.to_i, nil)
193
194
  end
194
- rescue EOFError, Errno::ECONNRESET
195
- log "eof from master"
195
+ rescue EOFError, Errno::ECONNRESET => e
196
+ @socket = nil
197
+ log "#{e.class.name} while reading from master"
196
198
  Process.kill(:QUIT, $$)
197
199
  end
198
200
 
@@ -234,8 +236,10 @@ module Resqued
234
236
  # report_to_master("+12345,queue") # Worker process PID:12345 started, working on a job from "queue".
235
237
  # report_to_master("-12345") # Worker process PID:12345 exited.
236
238
  def report_to_master(status)
237
- @socket.puts(status)
238
- rescue Errno::EPIPE
239
+ @socket.puts(status) if @socket
240
+ rescue Errno::EPIPE => e
241
+ @socket = nil
242
+ log "#{e.class.name} while writing to master"
239
243
  Process.kill(:QUIT, $$) # If the master is gone, LIFE IS NOW MEANINGLESS.
240
244
  end
241
245
 
@@ -20,6 +20,7 @@ module Resqued
20
20
  @config_paths = options.fetch(:config_paths)
21
21
  @pidfile = options.fetch(:master_pidfile) { nil }
22
22
  @status_pipe = options.fetch(:status_pipe) { nil }
23
+ @fast_exit = options.fetch(:fast_exit) { false }
23
24
  @listener_backoff = Backoff.new
24
25
  @listeners_created = 0
25
26
  end
@@ -66,7 +67,7 @@ module Resqued
66
67
  when :INT, :TERM, :QUIT
67
68
  log "Shutting down..."
68
69
  kill_all_listeners(signal)
69
- wait_for_workers
70
+ wait_for_workers unless @fast_exit
70
71
  break
71
72
  end
72
73
  end
@@ -1,3 +1,3 @@
1
1
  module Resqued
2
- VERSION = '0.8.2'
2
+ VERSION = '0.8.3'
3
3
  end
@@ -27,4 +27,8 @@ describe Resqued::Sleepy do
27
27
  it 'does not sleep if duration is negative' do
28
28
  expect { yawn(0) }.to run_for(0.0)
29
29
  end
30
+
31
+ it 'sleeps if io is nil' do
32
+ expect { yawn(0.5, nil) }.to run_for(0.5)
33
+ end
30
34
  end
metadata CHANGED
@@ -1,89 +1,89 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resqued
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Burke
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-01 00:00:00.000000000 Z
11
+ date: 2016-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kgio
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: resque
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.9.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.9.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mono_logger
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.0'
62
- - - <
62
+ - - "<"
63
63
  - !ruby/object:Gem::Version
64
64
  version: '2.99'
65
65
  type: :development
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ~>
69
+ - - "~>"
70
70
  - !ruby/object:Gem::Version
71
71
  version: '2.0'
72
- - - <
72
+ - - "<"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '2.99'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rake
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ~>
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: 0.9.0
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ~>
86
+ - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: 0.9.0
89
89
  description: Daemon of resque workers
@@ -94,13 +94,22 @@ executables:
94
94
  extensions: []
95
95
  extra_rdoc_files: []
96
96
  files:
97
+ - CHANGES.md
98
+ - MIT-LICENSE
99
+ - README.md
100
+ - docs/ipc.md
101
+ - docs/processes.md
102
+ - docs/signals.md
103
+ - exe/resqued
104
+ - exe/resqued-listener
105
+ - lib/resqued.rb
97
106
  - lib/resqued/backoff.rb
107
+ - lib/resqued/config.rb
98
108
  - lib/resqued/config/after_fork.rb
99
109
  - lib/resqued/config/base.rb
100
110
  - lib/resqued/config/before_fork.rb
101
111
  - lib/resqued/config/dsl.rb
102
112
  - lib/resqued/config/worker.rb
103
- - lib/resqued/config.rb
104
113
  - lib/resqued/daemon.rb
105
114
  - lib/resqued/listener.rb
106
115
  - lib/resqued/listener_proxy.rb
@@ -113,13 +122,6 @@ files:
113
122
  - lib/resqued/test_case.rb
114
123
  - lib/resqued/version.rb
115
124
  - lib/resqued/worker.rb
116
- - lib/resqued.rb
117
- - README.md
118
- - CHANGES.md
119
- - MIT-LICENSE
120
- - docs/ipc.md
121
- - docs/processes.md
122
- - docs/signals.md
123
125
  - spec/fixtures/test_case_after_fork_raises.rb
124
126
  - spec/fixtures/test_case_before_fork_raises.rb
125
127
  - spec/fixtures/test_case_clean.rb
@@ -134,8 +136,6 @@ files:
134
136
  - spec/resqued/test_case_spec.rb
135
137
  - spec/spec_helper.rb
136
138
  - spec/support/custom_matchers.rb
137
- - exe/resqued
138
- - exe/resqued-listener
139
139
  homepage: https://github.com/spraints/resqued
140
140
  licenses:
141
141
  - MIT
@@ -146,17 +146,17 @@ require_paths:
146
146
  - lib
147
147
  required_ruby_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - '>='
149
+ - - ">="
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  requirements:
154
- - - '>='
154
+ - - ">="
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  requirements: []
158
158
  rubyforge_project:
159
- rubygems_version: 2.0.14.1
159
+ rubygems_version: 2.5.1
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: Daemon of resque workers
@@ -175,3 +175,4 @@ test_files:
175
175
  - spec/resqued/test_case_spec.rb
176
176
  - spec/spec_helper.rb
177
177
  - spec/support/custom_matchers.rb
178
+ has_rdoc: