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


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

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.rpush(:failed, MultiJson.encode(data))
  raise
end