Class: CanvasSync::JobBatches::Sidekiq::ClientMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/canvas_sync/job_batches/sidekiq.rb

Instance Method Summary collapse

Instance Method Details

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



44
45
46
47
48
49
# File 'lib/canvas_sync/job_batches/sidekiq.rb', line 44

def call(_worker, msg, _queue, _redis_pool = nil)
  if (batch = Thread.current[CURRENT_BATCH_THREAD_KEY]) && should_handle_batch?(msg)
    batch.increment_job_queue(msg['jid']) if (msg[:bid] = batch.bid)
  end
  yield
end

#should_handle_batch?(msg) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
54
# File 'lib/canvas_sync/job_batches/sidekiq.rb', line 51

def should_handle_batch?(msg)
  return false if JobBatches::Sidekiq.is_activejob_job?(msg)
  true
end