Module: Simplekiq::BatchingJob
- Includes:
- Sidekiq::Worker
- Defined in:
- lib/simplekiq/batching_job.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- BATCH_CLASS_NAME =
"SimplekiqBatch"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
69 70 71 72 73 74 |
# File 'lib/simplekiq/batching_job.rb', line 69 def included(klass) batch_job_class = Class.new(BaseBatch) klass.const_set(BATCH_CLASS_NAME, batch_job_class) klass.extend ClassMethods end |
Instance Method Details
#perform(*args) ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/simplekiq/batching_job.rb', line 86 def perform(*args) self.batches = [] perform_batching(*args) # If we're part of an existing sidekiq batch make this a child batch # This is necessary for it work with orchestration; we could add an option # to toggle the behavior on and off. if batch batch.jobs do handle_batches(args) end else handle_batches(args) end end |