Class: CanvasSync::JobBatches::Sidekiq::ClientMiddleware
- Inherits:
-
Object
- Object
- CanvasSync::JobBatches::Sidekiq::ClientMiddleware
- 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[:batch]) && should_handle_batch?(msg) batch.increment_job_queue(msg['jid']) if (msg[:bid] = batch.bid) end yield end |
#should_handle_batch?(msg) ⇒ Boolean
51 52 53 54 |
# File 'lib/canvas_sync/job_batches/sidekiq.rb', line 51 def should_handle_batch?(msg) return false if msg['class'] == 'ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper' && msg['wrapped'].constantize < BatchAwareJob true end |