File: sidekiq.rb

package info (click to toggle)
ruby-exception-notification 4.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 808 kB
  • sloc: javascript: 7,680; ruby: 1,130; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 432 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'sidekiq'

module ExceptionNotification
  class Sidekiq

    def call(worker, msg, queue)
      begin
        yield
      rescue Exception => exception
        ExceptionNotifier.notify_exception(exception, :data => { :sidekiq => msg })
        raise exception
      end
    end

  end
end

::Sidekiq.configure_server do |config|
  config.server_middleware do |chain|
    chain.add ::ExceptionNotification::Sidekiq
  end
end