lib/pliny/sidekiq/middleware/client/log.rb in pliny-sidekiq-0.1.0 vs lib/pliny/sidekiq/middleware/client/log.rb in pliny-sidekiq-0.1.1
- old
+ new
@@ -1,15 +1,17 @@
module Pliny::Sidekiq::Middleware
module Client
class Log
def call(worker_class, msg, queue, redis_pool)
yield.tap do
- Pliny.log(
- job: msg['class'],
- job_id: msg['jid'],
- enqueued: true,
- enqueued_at: Time.at(msg['enqueued_at'])
- )
+ data = {
+ job: msg['class'],
+ job_id: msg['jid'],
+ enqueued: true
+ }
+ data[:enqueued_at] = Time.at(msg['enqueued_at']) if msg.has_key?('enqueued_at')
+
+ Pliny.log(data)
end
end
end
end
end