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
24 25 26 27 28 29 |
# File 'lib/canvas_sync/job_batches/sidekiq.rb', line 24 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
31 32 33 34 |
# File 'lib/canvas_sync/job_batches/sidekiq.rb', line 31 def should_handle_batch?(msg) return false if msg['class'] == 'ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper' && msg['wrapped'].constantize.is_a?(BatchAwareJob) true end |