Sha256: a8906fd6768a74789103ba711df19c5c26cb0354e9988e92ea7b31ad3f9c8b82

Contents?: true

Size: 785 Bytes

Versions: 8

Compression:

Stored size: 785 Bytes

Contents

begin
  require 'delayed_job'
rescue LoadError
end

# Based on the Sentry equivalent.
if defined?(Delayed)

  module Delayed
    module Plugins
      class Opbeat < ::Delayed::Plugin
        callbacks do |lifecycle|
          lifecycle.around(:invoke_job) do |job, *args, &block|
            begin
              # Forward the call to the next callback in the callback chain
              block.call(job, *args)

            rescue Exception => exception
              # Log error to Opbeat
              ::Opbeat.captureException(exception)
              # Make sure we propagate the failure!
              raise exception
            end
          end
        end
      end
    end
  end

  # Register DelayedJob Opbeat plugin
  Delayed::Worker.plugins << Delayed::Plugins::Opbeat
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
opbeat-0.9.2 lib/opbeat/integrations/delayed_job.rb
opbeat-0.9.1 lib/opbeat/integrations/delayed_job.rb
opbeat-0.9.0 lib/opbeat/integrations/delayed_job.rb
opbeat-0.8.0 lib/opbeat/integrations/delayed_job.rb
opbeat-0.7.1 lib/opbeat/integrations/delayed_job.rb
opbeat-0.7.0 lib/opbeat/integrations/delayed_job.rb
opbeat-0.6.1 lib/opbeat/integrations/delayed_job.rb
opbeat-0.6.0 lib/opbeat/integrations/delayed_job.rb