Class: CanvasSync::JobUniqueness::Compat::Sidekiq::ClientMiddleware

Inherits:
CommonMiddleware
  • Object
show all
Includes:
Sidekiq::ClientMiddleware
Defined in:
lib/canvas_sync/job_uniqueness/compat/sidekiq.rb

Instance Method Summary collapse

Methods inherited from CommonMiddleware

#lock_context, #worker_uniqueness

Instance Method Details

#call(_worker, msg, _queue, _redis_pool = nil, &blk) ⇒ Object



58
59
60
61
62
63
# File 'lib/canvas_sync/job_uniqueness/compat/sidekiq.rb', line 58

def call(_worker, msg, _queue, _redis_pool = nil, &blk)
  ctx = lock_context(msg)
  return blk.call unless ctx
  msg['uniqueness_cache_data'] = ctx.cache_data.stringify_keys
  ctx.handle_lifecycle!(:enqueue, &blk)
end