Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 540 Bytes

failure-handling.md

File metadata and controls

26 lines (20 loc) · 540 Bytes

Failure handling

Way 1: sidekiq_retries_exhausted hook

class HardJob
  sidekiq_options queue: :hard, retry: 2

  sidekiq_retries_exhausted do |msg, ex|
    Rails.logger.warn("Failed #{msg['class']} with #{msg['args']}: #{msg['error_message']}")

    # Do stuff
  end
end

Way 2: Sidekiq configuration

Sidekiq.configure_server do |config|
  # Other config

  config.death_handlers << ->(job, ex) do
    Rails.logger.error "Uh oh, #{job['class']} #{job["jid"]} just died with error #{ex.message}."
  end
end