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)
|
||||
logger.debug { "Dropping message after hitting the retry maximum: #{msg}" }
|
||||
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'])
|
||||
elsif worker.sidekiq_retries_exhausted_block?
|
||||
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} }
|
||||
|
||||
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
|
||||
worker.expect(:retries_exhausted, true, [1,2,"foo"])
|
||||
task_misbehaving_worker
|
||||
worker.verify
|
||||
assert_equal [1,2, "foo", "retried_method"], handler.retries_exhausted(worker.new, msg)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -197,7 +207,7 @@ class TestRetry < Minitest::Test
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue