Sha256: 557fd343a72e0f5de2e52ebb2e543f105bd2a4fa342de22d55dbdc4cd8cd8141

Contents?: true

Size: 786 Bytes

Versions: 8

Compression:

Stored size: 786 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.capture_exception(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 & 2 rubygems

Version Path
kuende-opbeat-2.0.4 lib/opbeat/integrations/delayed_job.rb
kuende-opbeat-2.0.3 lib/opbeat/integrations/delayed_job.rb
kuende-opbeat-2.0.2 lib/opbeat/integrations/delayed_job.rb
kuende-opbeat-2.0.1 lib/opbeat/integrations/delayed_job.rb
opbeat-2.0.0 lib/opbeat/integrations/delayed_job.rb
opbeat-1.1.1 lib/opbeat/integrations/delayed_job.rb
opbeat-1.1.0 lib/opbeat/integrations/delayed_job.rb
opbeat-1.0.0 lib/opbeat/integrations/delayed_job.rb