Sha256: 2b9743f7dcf363d0a2990e046ae573a7825bbe306010bb69f281af80923a9f90

Contents?: true

Size: 643 Bytes

Versions: 10

Compression:

Stored size: 643 Bytes

Contents

# based on http://bit.ly/VGdfVI

module Delayed
  module Plugins
    class Ratchetio < Plugin
      module ReportErrors
        def error(job, error)
          # send the job object as the 'request data'
          ::Ratchetio.report_exception(error, job)
          super if defined?(super)
        end
      end

      callbacks do |lifecycle|
        lifecycle.before(:invoke_job) do |job|
          payload = job.payload_object
          payload = payload.object if payload.is_a? Delayed::PerformableMethod
          payload.extend ReportErrors
        end
      end
    end
  end
end

Delayed::Worker.plugins << Delayed::Plugins::Ratchetio

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ratchetio-0.7.1 lib/ratchetio/delayed_job.rb
ratchetio-0.7.0 lib/ratchetio/delayed_job.rb
ratchetio-0.6.3 lib/ratchetio/delayed_job.rb
ratchetio-0.6.1 lib/ratchetio/delayed_job.rb
ratchetio-0.6.0 lib/ratchetio/delayed_job.rb
ratchetio-0.5.5 lib/ratchetio/delayed_job.rb
ratchetio-0.5.3 lib/ratchetio/delayed_job.rb
ratchetio-0.5.2 lib/ratchetio/delayed_job.rb
ratchetio-0.5.1 lib/ratchetio/delayed_job.rb
ratchetio-0.5.0 lib/ratchetio/delayed_job.rb