Sha256: b2174271a45f648336df327cec696dab5c556fe266b6af1dc9c32eb5743f4001

Contents?: true

Size: 893 Bytes

Versions: 1

Compression:

Stored size: 893 Bytes

Contents

module AppfluxRuby
  module Delayed
    class Plugin < ::Delayed::Plugin
      callbacks do |lifecycle|
        lifecycle.around(:invoke_job) do |job, *args, &block|
          begin
            block.call(job, *args)
          rescue Exception => exception
            ::AppfluxRuby::Bugflux.initialize_additional_data
            params = job.as_json.merge(
              component: 'delayed_job',
              action: job.payload_object.class.name
            )

            # If DelayedJob is used through ActiveJob, it contains extra info.
            if job.payload_object.respond_to?(:job_data)
              params[:active_job] = job.payload_object.job_data
            end
            ::AppfluxRuby::BugfluxNotifier.notify(exception, params)
            raise exception
          end
        end
      end
    end
  end
end

# Delayed::Worker.plugins << Delayed::Plugins::AppfluxRuby

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
appflux_ruby-0.1.2 lib/appflux_ruby/delayed/plugin.rb