Search code examples
ruby-on-railsredissidekiq

sidekiq won't send exception notifier emails


How can I enable emails to be sent from sidekiq when it fails? Currently I know exception notifier is working, though when a sidekiq job fails, it doesn't do anything.


Solution

  • class DelayedWorker
    
      include Sidekiq::Worker
      # Utils include watchdog, which will email on failures
      include Sidekiq::Util
    
      def perform(type, args)
        watchdog('DelayedWorker failed') do
          raise 'Doh!'
          puts "Doing hard work #{type} #{args.to_json}"
        end
      end
    
    end
    

    Also make sure you have the newer version of exception notifier, which takes in 2 arguments into it's handle_background_exception method