mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Add link to Error-Handling wiki page
This commit is contained in:
parent
ba2ec5800e
commit
f58f6b1947
2 changed files with 15 additions and 5 deletions
|
@ -96,7 +96,7 @@ module Sidekiq
|
||||||
def retries_exhausted(worker, msg)
|
def retries_exhausted(worker, msg)
|
||||||
logger.debug { "Dropping message after hitting the retry maximum: #{msg}" }
|
logger.debug { "Dropping message after hitting the retry maximum: #{msg}" }
|
||||||
if worker.respond_to?(:retries_exhausted)
|
if worker.respond_to?(:retries_exhausted)
|
||||||
logger.warn { "Defining `retries_exhausted` as a method is deprecated, use the `sidekiq_retries_exhausted` callback instead" }
|
logger.warn { "Defining #{worker.class.name}#retries_exhausted as a method is deprecated, use `sidekiq_retries_exhausted` callback instead http://git.io/Ijju8g" }
|
||||||
worker.retries_exhausted(*msg['args'])
|
worker.retries_exhausted(*msg['args'])
|
||||||
elsif worker.sidekiq_retries_exhausted_block?
|
elsif worker.sidekiq_retries_exhausted_block?
|
||||||
worker.sidekiq_retries_exhausted_block.call(*msg['args'])
|
worker.sidekiq_retries_exhausted_block.call(*msg['args'])
|
||||||
|
|
|
@ -180,10 +180,20 @@ class TestRetry < Minitest::Test
|
||||||
let(:msg){ {"class"=>"Bob", "args"=>[1, 2, "foo"], "queue"=>"default", "error_message"=>"kerblammo!", "error_class"=>"RuntimeError", "failed_at"=>Time.now.utc, "retry"=>3, "retry_count"=>3} }
|
let(:msg){ {"class"=>"Bob", "args"=>[1, 2, "foo"], "queue"=>"default", "error_message"=>"kerblammo!", "error_class"=>"RuntimeError", "failed_at"=>Time.now.utc, "retry"=>3, "retry_count"=>3} }
|
||||||
|
|
||||||
describe "worker method" do
|
describe "worker method" do
|
||||||
|
let(:worker) do
|
||||||
|
klass = Class.new do
|
||||||
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
def self.name; "Worker"; end
|
||||||
|
|
||||||
|
def retries_exhausted(*args)
|
||||||
|
args << "retried_method"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it 'calls worker.retries_exhausted after too many retries' do
|
it 'calls worker.retries_exhausted after too many retries' do
|
||||||
worker.expect(:retries_exhausted, true, [1,2,"foo"])
|
assert_equal [1,2, "foo", "retried_method"], handler.retries_exhausted(worker.new, msg)
|
||||||
task_misbehaving_worker
|
|
||||||
worker.verify
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -197,7 +207,7 @@ class TestRetry < Minitest::Test
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'calls worker sidekiq_retries_exhausted_block after too many retries' do
|
it 'calls worker sidekiq_retries_exhausted_block after too many retries' do
|
||||||
assert_equal [1,2, "foo", "retried"], handler.retries_exhausted(worker, msg)
|
assert_equal [1,2, "foo", "retried"], handler.retries_exhausted(worker.new, msg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue