resqued 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGES.md +5 -0
- data/lib/resqued/config/worker.rb +1 -1
- data/lib/resqued/listener.rb +2 -0
- data/lib/resqued/listener_proxy.rb +4 -1
- data/lib/resqued/version.rb +1 -1
- data/spec/resqued/backoff_spec.rb +8 -8
- data/spec/resqued/config/worker_spec.rb +11 -0
- data/spec/resqued/test_case_spec.rb +2 -2
- data/spec/support/custom_matchers.rb +9 -1
- metadata +21 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 477007ffc7e6d2630b794ef021d1bbe2bc4f2cc5fc5df95fbd91b92f2e6121fe
|
4
|
+
data.tar.gz: 39531525a5afdd44ab077f69355d5b17a615f6430c21171bbd8cddc36adbaf66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0f13ad32bc91c04058201882a00a65d4f67da7f3fadd19cac227eaca76d1816b47987f517a53d2ec03de9c39b3ff2c7ed6b2956e44ff0890cea0eb467085adc
|
7
|
+
data.tar.gz: 6c8399d793a329ae717d18c38dfca7e1f5b286e218e6ae39b5ce9deaed26b12a325d7e49292f5687a5ecb1e3814360fe9d5c6b670e0a5d49ed01473b978008c4
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,10 @@
|
|
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.10.1
|
4
|
+
-------
|
5
|
+
* Avoid deadlock if a listener stops responding. (#58)
|
6
|
+
* When using 'percent' for a queue in a worker pool, always assign at least one worker. (#57)
|
7
|
+
|
3
8
|
v0.10.0
|
4
9
|
-------
|
5
10
|
* Master process restarts itself (#51), so that it doesn't continue running stale code indefinitely. This will help with the rollout process when changes like #50 are introduced, so that the master process will catch up. The risk of this is that the master process might not be able to be restarted, which would lead to it crashing. The mostly likely way for that to happen is if you try to roll back your version of resqued to 0.9.0 or earlier. If you need to do that, ensure that your process monitor (systemd, god, etc.) is able to restart the master process. You can disable the new behavior by passing `--no-exec-on-hup`.
|
@@ -112,7 +112,7 @@ module Resqued
|
|
112
112
|
elsif value.is_a?(1.class)
|
113
113
|
value < @pool_size ? value : @pool_size
|
114
114
|
elsif value.is_a?(Float) && value >= 0.0 && value <= 1.0
|
115
|
-
(@pool_size * value).to_i
|
115
|
+
[(@pool_size * value).to_i, 1].max
|
116
116
|
else
|
117
117
|
raise TypeError, "Unknown concurrency value: #{value.inspect}"
|
118
118
|
end
|
data/lib/resqued/listener.rb
CHANGED
@@ -99,7 +99,10 @@ module Resqued
|
|
99
99
|
def worker_finished(pid)
|
100
100
|
return if @state.master_socket.nil?
|
101
101
|
|
102
|
-
@state.master_socket.
|
102
|
+
@state.master_socket.write_nonblock("#{pid}\n")
|
103
|
+
rescue IO::WaitWritable
|
104
|
+
log "Couldn't tell #{@state.pid} that #{pid} exited!"
|
105
|
+
# Ignore it, maybe the next time it'll work.
|
103
106
|
rescue Errno::EPIPE
|
104
107
|
@state.master_socket.close
|
105
108
|
@state.master_socket = nil
|
data/lib/resqued/version.rb
CHANGED
@@ -6,7 +6,7 @@ describe Resqued::Backoff do
|
|
6
6
|
let(:backoff) { described_class.new(min: 0.5, max: 64.0) }
|
7
7
|
|
8
8
|
it "can start on the first try" do
|
9
|
-
expect(backoff.wait?).to
|
9
|
+
expect(backoff.wait?).to be_falsey
|
10
10
|
end
|
11
11
|
|
12
12
|
it "has no waiting at first" do
|
@@ -15,42 +15,42 @@ describe Resqued::Backoff do
|
|
15
15
|
|
16
16
|
context "after expected exits" do
|
17
17
|
before { 3.times { backoff.started } }
|
18
|
-
it { expect(backoff.wait?).to
|
18
|
+
it { expect(backoff.wait?).to be true }
|
19
19
|
it { expect(backoff.how_long?).to be_close_to(0.5) }
|
20
20
|
end
|
21
21
|
|
22
22
|
context "after one quick exit" do
|
23
23
|
before { 1.times { backoff.started; backoff.died } }
|
24
|
-
it { expect(backoff.wait?).to
|
24
|
+
it { expect(backoff.wait?).to be true }
|
25
25
|
it { expect(backoff.how_long?).to be_close_to(1.0) }
|
26
26
|
end
|
27
27
|
|
28
28
|
context "after two quick starts" do
|
29
29
|
before { 2.times { backoff.started; backoff.died } }
|
30
|
-
it { expect(backoff.wait?).to
|
30
|
+
it { expect(backoff.wait?).to be true }
|
31
31
|
it { expect(backoff.how_long?).to be_close_to(2.0) }
|
32
32
|
end
|
33
33
|
|
34
34
|
context "after five quick starts" do
|
35
35
|
before { 6.times { backoff.started; backoff.died } }
|
36
|
-
it { expect(backoff.wait?).to
|
36
|
+
it { expect(backoff.wait?).to be true }
|
37
37
|
it { expect(backoff.how_long?).to be_close_to(32.0) }
|
38
38
|
end
|
39
39
|
|
40
40
|
context "after six quick starts" do
|
41
41
|
before { 7.times { backoff.started; backoff.died } }
|
42
|
-
it { expect(backoff.wait?).to
|
42
|
+
it { expect(backoff.wait?).to be true }
|
43
43
|
it { expect(backoff.how_long?).to be_close_to(64.0) }
|
44
44
|
end
|
45
45
|
|
46
46
|
context "does not wait longer than 64s" do
|
47
47
|
before { 8.times { backoff.started; backoff.died } }
|
48
|
-
it { expect(backoff.wait?).to
|
48
|
+
it { expect(backoff.wait?).to be true }
|
49
49
|
it { expect(backoff.how_long?).to be_close_to(64.0) }
|
50
50
|
it "and resets after an expected exit" do
|
51
51
|
backoff.started
|
52
52
|
backoff.started
|
53
|
-
expect(backoff.wait?).to
|
53
|
+
expect(backoff.wait?).to be true
|
54
54
|
expect(backoff.how_long?).to be_close_to(0.5)
|
55
55
|
end
|
56
56
|
end
|
@@ -55,6 +55,17 @@ describe Resqued::Config::Worker do
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
context "small pool with percent" do
|
59
|
+
let(:config) { <<-END_CONFIG }
|
60
|
+
worker_pool 2
|
61
|
+
queue "a"
|
62
|
+
queue "b", :percent => 45
|
63
|
+
END_CONFIG
|
64
|
+
it { expect(result.size).to eq(2) }
|
65
|
+
it { expect(result[0]).to eq(queues: ["a", "b"]) }
|
66
|
+
it { expect(result[1]).to eq(queues: ["a"]) }
|
67
|
+
end
|
68
|
+
|
58
69
|
context "pool (hash for concurrency)" do
|
59
70
|
let(:config) { <<-END_CONFIG }
|
60
71
|
before_fork { }
|
@@ -7,8 +7,8 @@ describe Resqued::TestCase do
|
|
7
7
|
context "LoadConfig" do
|
8
8
|
let(:the_module) { described_class::LoadConfig }
|
9
9
|
it { expect { test_case.assert_resqued "spec/fixtures/test_case_environment.rb", "spec/fixtures/test_case_clean.rb" }.not_to raise_error }
|
10
|
-
it { expect { test_case.assert_resqued "spec/fixtures/test_case_environment.rb", "spec/fixtures/test_case_before_fork_raises.rb" }.to raise_error }
|
11
|
-
it { expect { test_case.assert_resqued "spec/fixtures/test_case_environment.rb", "spec/fixtures/test_case_after_fork_raises.rb" }.to raise_error }
|
10
|
+
it { expect { test_case.assert_resqued "spec/fixtures/test_case_environment.rb", "spec/fixtures/test_case_before_fork_raises.rb" }.to raise_error(RuntimeError) }
|
11
|
+
it { expect { test_case.assert_resqued "spec/fixtures/test_case_environment.rb", "spec/fixtures/test_case_after_fork_raises.rb" }.to raise_error(RuntimeError) }
|
12
12
|
it { expect { test_case.assert_resqued "spec/fixtures/test_case_environment.rb", "spec/fixtures/test_case_no_workers.rb" }.not_to raise_error }
|
13
13
|
end
|
14
14
|
end
|
@@ -11,6 +11,10 @@ module CustomMatchers
|
|
11
11
|
@epsilon = 0.01
|
12
12
|
end
|
13
13
|
|
14
|
+
def supports_block_expectations?
|
15
|
+
true
|
16
|
+
end
|
17
|
+
|
14
18
|
def within(epsilon)
|
15
19
|
@epsilon = epsilon
|
16
20
|
self
|
@@ -24,9 +28,13 @@ module CustomMatchers
|
|
24
28
|
@epsilon >= diff
|
25
29
|
end
|
26
30
|
|
27
|
-
def
|
31
|
+
def failure_message
|
28
32
|
"Expected block to run for #{@expected_duration} +/-#{@epsilon} seconds, but it ran for #{@actual_duration} seconds."
|
29
33
|
end
|
34
|
+
|
35
|
+
def failure_message_when_negated
|
36
|
+
"Expected block not to run for #{@expected_duration} +/-#{@epsilon} seconds, but it ran for #{@actual_duration} seconds."
|
37
|
+
end
|
30
38
|
end
|
31
39
|
end
|
32
40
|
|
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.10.
|
4
|
+
version: 0.10.1
|
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: 2020-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kgio
|
@@ -56,36 +56,30 @@ dependencies:
|
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 13.0.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 13.0.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '2.0'
|
76
|
-
- - "<"
|
73
|
+
- - '='
|
77
74
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
75
|
+
version: 3.9.0
|
79
76
|
type: :development
|
80
77
|
prerelease: false
|
81
78
|
version_requirements: !ruby/object:Gem::Requirement
|
82
79
|
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '2.0'
|
86
|
-
- - "<"
|
80
|
+
- - '='
|
87
81
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
82
|
+
version: 3.9.0
|
89
83
|
- !ruby/object:Gem::Dependency
|
90
84
|
name: rubocop
|
91
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,24 +166,23 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
166
|
- !ruby/object:Gem::Version
|
173
167
|
version: '0'
|
174
168
|
requirements: []
|
175
|
-
|
176
|
-
rubygems_version: 2.5.2.1
|
169
|
+
rubygems_version: 3.0.3
|
177
170
|
signing_key:
|
178
171
|
specification_version: 4
|
179
172
|
summary: Daemon of resque workers
|
180
173
|
test_files:
|
181
|
-
- spec/resqued/sleepy_spec.rb
|
182
|
-
- spec/resqued/backoff_spec.rb
|
183
|
-
- spec/resqued/config/worker_spec.rb
|
184
|
-
- spec/resqued/config/fork_event_spec.rb
|
185
|
-
- spec/resqued/start_ctx_spec.rb
|
186
|
-
- spec/resqued/config_spec.rb
|
187
|
-
- spec/resqued/test_case_spec.rb
|
188
174
|
- spec/spec_helper.rb
|
175
|
+
- spec/test_restart.sh
|
176
|
+
- spec/support/custom_matchers.rb
|
177
|
+
- spec/fixtures/test_case_clean.rb
|
189
178
|
- spec/fixtures/test_case_before_fork_raises.rb
|
190
179
|
- spec/fixtures/test_case_environment.rb
|
191
180
|
- spec/fixtures/test_case_no_workers.rb
|
192
181
|
- spec/fixtures/test_case_after_fork_raises.rb
|
193
|
-
- spec/
|
194
|
-
- spec/
|
195
|
-
- spec/
|
182
|
+
- spec/resqued/config_spec.rb
|
183
|
+
- spec/resqued/config/fork_event_spec.rb
|
184
|
+
- spec/resqued/config/worker_spec.rb
|
185
|
+
- spec/resqued/sleepy_spec.rb
|
186
|
+
- spec/resqued/test_case_spec.rb
|
187
|
+
- spec/resqued/start_ctx_spec.rb
|
188
|
+
- spec/resqued/backoff_spec.rb
|