Sha256: e39356398f3547b1c7924290e8edca6c10a7492c74f571f48fb0684f4226689a

Contents?: true

Size: 607 Bytes

Versions: 6

Compression:

Stored size: 607 Bytes

Contents

require 'multi_json'

module Sidekiq
  module Middleware
    module Server
      class FailureJobs
        def call(*args)
          yield
        rescue => e
          data = {
            :failed_at => Time.now.strftime("%Y/%m/%d %H:%M:%S %Z"),
            :payload => args[1],
            :exception => e.class.to_s,
            :error => e.to_s,
            :backtrace => e.backtrace,
            :worker => args[1]['class'],
            :queue => args[2]
          }
          Sidekiq.redis {|conn| conn.rpush(:failed, Sidekiq.dump_json(data)) }
          raise
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
kulesa-sidekiq-1.2.3 lib/sidekiq/middleware/server/failure_jobs.rb
kulesa-sidekiq-1.2.2 lib/sidekiq/middleware/server/failure_jobs.rb
sidekiq-1.2.1 lib/sidekiq/middleware/server/failure_jobs.rb
sidekiq-1.2.0 lib/sidekiq/middleware/server/failure_jobs.rb
sidekiq-1.1.4 lib/sidekiq/middleware/server/failure_jobs.rb
sidekiq-1.1.3 lib/sidekiq/middleware/server/failure_jobs.rb