Class: Sidekiq::Ichnite::ClientMiddleware

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

Instance Method Summary collapse

Instance Method Details

#call(worker_class, msg, queue, _redis_pool) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ichnite/sidekiq/middleware.rb', line 36

def call(worker_class, msg, queue, _redis_pool)
  context = {
    queue: queue,
    job_id: Sidekiq::Ichnite.job_id(msg),
    job_class: Sidekiq::Ichnite.job_class(msg)
  }
  if at = msg['at']
    context[:scheduled_at] = Time.at(at).utc
    ::Ichnite.log('job_schedule', context)
  else
    context[:args] = Sidekiq::Ichnite.job_args(msg)
    ::Ichnite.log('job_enqueue', context)
  end
  yield
end