Class: Sidekiq::Middleware::Server::FailureJobs

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/middleware/server/failure_jobs.rb

Instance Method Summary collapse

Instance Method Details

#call(*args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sidekiq/middleware/server/failure_jobs.rb', line 7

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