Class: SidekiqBatch::ClientMiddleware
- Inherits:
-
Object
- Object
- SidekiqBatch::ClientMiddleware
- Defined in:
- app/models/sidekiq_batch/client_middleware.rb
Overview
Sidekiq client middleware. Registered outermost (via ‘chain.prepend`) so that any dedupe/suppression middleware added later with `chain.add` has already decided whether the job will be pushed by the time we inspect the yield result. We enroll only when the chain returns a truthy payload (i.e. the push is going ahead).
Instance Method Summary collapse
Instance Method Details
#call(_worker_class, job, _queue, _redis_pool) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/models/sidekiq_batch/client_middleware.rb', line 10 def call(_worker_class, job, _queue, _redis_pool) result = yield context = ::SidekiqBatch::BatchEnrollmentContext.current context.enroll(job) if result && context result end |