sidekiq 4.2.3 → 4.2.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sidekiq might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Changes.md +6 -0
- data/lib/sidekiq/processor.rb +14 -14
- data/lib/sidekiq/version.rb +1 -1
- data/test/test_processor.rb +34 -0
- 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: 581035f739e6ecf4fdd07d42b7ff78b1012f3ad2
|
4
|
+
data.tar.gz: 26c02597dab733a1fdf7d948a7a274029033ae21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ace3433e3bc81e986d56177f392a54f24e9a6f5cd1a050107d5273271cc61df5b022dfae32f99fb0cd74b71d5c9470daebca8073a5106bbe605f71d788196500
|
7
|
+
data.tar.gz: abca98c2d32c438dfc4f60e8dabcea79cc0f28c616d62942a02f768bb0353199abd139aacdc12db546ee19e66b95fb0a36644104dd47c663f034f02882bffd24
|
data/Changes.md
CHANGED
data/lib/sidekiq/processor.rb
CHANGED
@@ -119,9 +119,9 @@ module Sidekiq
|
|
119
119
|
jobstr = work.job
|
120
120
|
queue = work.queue_name
|
121
121
|
|
122
|
-
|
123
|
-
|
124
|
-
|
122
|
+
ack = false
|
123
|
+
begin
|
124
|
+
@reloader.call do
|
125
125
|
job = Sidekiq.load_json(jobstr)
|
126
126
|
klass = job['class'.freeze].constantize
|
127
127
|
worker = klass.new
|
@@ -137,17 +137,17 @@ module Sidekiq
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
ack = true
|
140
|
-
rescue Sidekiq::Shutdown
|
141
|
-
# Had to force kill this job because it didn't finish
|
142
|
-
# within the timeout. Don't acknowledge the work since
|
143
|
-
# we didn't properly finish it.
|
144
|
-
ack = false
|
145
|
-
rescue Exception => ex
|
146
|
-
handle_exception(ex, { :context => "Job raised exception", :job => job, :jobstr => jobstr })
|
147
|
-
raise
|
148
|
-
ensure
|
149
|
-
work.acknowledge if ack
|
150
140
|
end
|
141
|
+
rescue Sidekiq::Shutdown
|
142
|
+
# Had to force kill this job because it didn't finish
|
143
|
+
# within the timeout. Don't acknowledge the work since
|
144
|
+
# we didn't properly finish it.
|
145
|
+
ack = false
|
146
|
+
rescue Exception => ex
|
147
|
+
handle_exception(ex, { :context => "Job raised exception", :job => job, :jobstr => jobstr })
|
148
|
+
raise
|
149
|
+
ensure
|
150
|
+
work.acknowledge if ack
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
@@ -165,7 +165,7 @@ module Sidekiq
|
|
165
165
|
|
166
166
|
def stats(worker, job, queue)
|
167
167
|
tid = thread_identity
|
168
|
-
WORKER_STATE[tid] = {:queue => queue, :payload => job, :run_at => Time.now.to_i }
|
168
|
+
WORKER_STATE[tid] = {:queue => queue, :payload => cloned(job), :run_at => Time.now.to_i }
|
169
169
|
|
170
170
|
begin
|
171
171
|
yield
|
data/lib/sidekiq/version.rb
CHANGED
data/test/test_processor.rb
CHANGED
@@ -65,6 +65,40 @@ class TestProcessor < Sidekiq::Test
|
|
65
65
|
assert_equal [['myarg']], msg['args']
|
66
66
|
end
|
67
67
|
|
68
|
+
describe 'exception handling' do
|
69
|
+
let(:errors) { [] }
|
70
|
+
let(:error_handler) { proc { |ex, _| errors << ex } }
|
71
|
+
|
72
|
+
before do
|
73
|
+
Sidekiq.error_handlers << error_handler
|
74
|
+
end
|
75
|
+
|
76
|
+
after do
|
77
|
+
Sidekiq.error_handlers.pop
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'handles exceptions raised by the job' do
|
81
|
+
msg = Sidekiq.dump_json({ 'class' => MockWorker.to_s, 'args' => ['boom'] })
|
82
|
+
begin
|
83
|
+
@processor.process(work(msg))
|
84
|
+
rescue TestException
|
85
|
+
end
|
86
|
+
assert_equal 1, errors.count
|
87
|
+
assert_instance_of TestException, errors.first
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'handles exceptions raised by the reloader' do
|
91
|
+
msg = Sidekiq.dump_json({ 'class' => MockWorker.to_s, 'args' => ['myarg'] })
|
92
|
+
@processor.instance_variable_set(:'@reloader', proc { raise TEST_EXCEPTION })
|
93
|
+
begin
|
94
|
+
@processor.process(work(msg))
|
95
|
+
rescue TestException
|
96
|
+
end
|
97
|
+
assert_equal 1, errors.count
|
98
|
+
assert_instance_of TestException, errors.first
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
68
102
|
describe 'acknowledgement' do
|
69
103
|
class ExceptionRaisingMiddleware
|
70
104
|
def initialize(raise_before_yield, raise_after_yield, skip)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Perham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|