resqued 0.10.3 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/docs/signals.md +4 -0
- data/lib/resqued/listener.rb +2 -1
- data/lib/resqued/version.rb +1 -1
- data/lib/resqued/worker.rb +5 -1
- data/spec/integration/listener_still_starting_spec.rb +1 -0
- data/spec/resqued/config/worker_spec.rb +8 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 606d7e3fb51d8595ce4a8e4fe7bdb28fc3aa73323652cbb98f9e0db19e982960
|
4
|
+
data.tar.gz: 87d0126e0b4f6e804a63d680d6946aa83621d19ddfa22c9427772d84eb9208df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abcd739a5f7d36a1e980b055e90e36cd63d0303264126f35a27ef260717022fda2ddd23630b13a954d93cb2f038067ae9d2579347b5ca1a48a19ab18528d5a2e
|
7
|
+
data.tar.gz: 82b66d4c943da3c73e5ae0459197fad97931770eeb3d6acd77b556f69d285e2c8666823b2f9fd563d25337974012d81b5e8d4f2f64b5f39d835e7c8dbada409c
|
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.11.0
|
4
|
+
-------
|
5
|
+
* Ignore SIGHUP in Listener and Worker processes. (#61)
|
6
|
+
|
3
7
|
v0.10.3
|
4
8
|
-------
|
5
9
|
* Fix a timing related crash during reload. (#60)
|
data/docs/signals.md
CHANGED
@@ -34,6 +34,8 @@ The Listener process forwards `SIGCONT` to all of its workers.
|
|
34
34
|
|
35
35
|
The Listener process handles `SIGINT`, `SIGTERM`, and `SIGQUIT`. When it receives one of these signals, it goes into shutdown mode. It sends the received signal to all of its workers. When all workers have exited, the Listener process exits.
|
36
36
|
|
37
|
+
The Listener process handles `SIGHUP` and does nothing. This makes it easier to reload resqued in a docker container, since many container platforms will send a requested signal to all processes in the container.
|
38
|
+
|
37
39
|
## Worker
|
38
40
|
|
39
41
|
The Worker process uses resque's signal handling. Resque 1.23.0 handles the following signals:
|
@@ -44,3 +46,5 @@ The Worker process uses resque's signal handling. Resque 1.23.0 handles the foll
|
|
44
46
|
* `USR1`: Kill the forked child immediately, continue processing jobs.
|
45
47
|
* `USR2`: Don't process any new jobs
|
46
48
|
* `CONT`: Start processing jobs again after a USR2
|
49
|
+
|
50
|
+
Resqued leaves a handler for `HUP` in place that does nothing. This makes it easier to reload resqued in a docker container, since many container platforms will send a requested signal to all processes in the container.
|
data/lib/resqued/listener.rb
CHANGED
@@ -63,12 +63,13 @@ module Resqued
|
|
63
63
|
end
|
64
64
|
|
65
65
|
SIGNALS = [:CONT, :QUIT, :INT, :TERM].freeze
|
66
|
-
ALL_SIGNALS = SIGNALS + [:CHLD]
|
66
|
+
ALL_SIGNALS = SIGNALS + [:CHLD, :HUP]
|
67
67
|
|
68
68
|
SIGNAL_QUEUE = [] # rubocop: disable Style/MutableConstant
|
69
69
|
|
70
70
|
# Public: Run the main loop.
|
71
71
|
def run
|
72
|
+
trap(:HUP) {} # ignore this, in case it trickles in from the master.
|
72
73
|
trap(:CHLD) { awake }
|
73
74
|
SIGNALS.each { |signal| trap(signal) { SIGNAL_QUEUE << signal; awake } }
|
74
75
|
@socket.close_on_exec = true
|
data/lib/resqued/version.rb
CHANGED
data/lib/resqued/worker.rb
CHANGED
@@ -91,7 +91,11 @@ module Resqued
|
|
91
91
|
else
|
92
92
|
# In case we get a signal before resque is ready for it.
|
93
93
|
Resqued::Listener::ALL_SIGNALS.each { |signal| trap(signal, "DEFAULT") }
|
94
|
-
|
94
|
+
# Continue ignoring SIGHUP, though.
|
95
|
+
trap(:HUP) {}
|
96
|
+
# If we get a QUIT during boot, just spin back down.
|
97
|
+
trap(:QUIT) { exit! 0 }
|
98
|
+
|
95
99
|
$0 = "STARTING RESQUE FOR #{queues.join(',')}"
|
96
100
|
resque_worker = @worker_factory.call(queues)
|
97
101
|
@config.after_fork(resque_worker)
|
@@ -125,17 +125,17 @@ describe Resqued::Config::Worker do
|
|
125
125
|
|
126
126
|
context "pool, with shuffled queues" do
|
127
127
|
let(:config) { <<-END_CONFIG }
|
128
|
-
worker_pool
|
129
|
-
queue 'a', :count =>
|
130
|
-
queue 'b', :count =>
|
128
|
+
worker_pool 200, :shuffle_queues => true
|
129
|
+
queue 'a', :count => 100
|
130
|
+
queue 'b', :count => 150
|
131
131
|
END_CONFIG
|
132
|
-
it { expect(result.size).to eq(
|
133
|
-
it { (0..
|
134
|
-
it { (
|
135
|
-
it { (
|
132
|
+
it { expect(result.size).to eq(200) }
|
133
|
+
it { (0..99).each { |i| expect(result[i][:queues].sort).to eq(["a", "b"]) } }
|
134
|
+
it { (100..149).each { |i| expect(result[i][:queues]).to eq(["b"]) } }
|
135
|
+
it { (150..199).each { |i| expect(result[i][:queues]).to eq(["*"]) } }
|
136
136
|
it { result.each { |x| expect(x).not_to have_key(:shuffle_queues) } }
|
137
137
|
it do
|
138
|
-
shuffled_queues = result.take(
|
138
|
+
shuffled_queues = result.take(100).map { |x| x[:queues] }
|
139
139
|
expect(shuffled_queues.sort.uniq).to eq([["a", "b"], ["b", "a"]]) # Some of the queues should be shuffled
|
140
140
|
end
|
141
141
|
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.
|
4
|
+
version: 0.11.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:
|
11
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kgio
|