breamware / sidekiq-batch

Sidekiq Batch Jobs Implementation
MIT License
357 stars 95 forks source link

on_success / on_complete does not trigger when jobs finishes too fast. #29

Closed jonathanbruno closed 4 years ago

jonathanbruno commented 5 years ago

I have a pretty common code which was supposed to call the on_success method when all jobs get finished.

batch = Sidekiq::Batch.new
batch.on(:complete, Scheduling::SidekiqBatch::Callbacks)
   batch.jobs do
   salesmen.each do |salesman|
      company_id = salesman[0]
      salesman_id = salesman[1]

      ExportationWorker.perform_async({
         company_id: company_id,
         salesman_id: salesman_id
      })
   end
end

in general the ExportationWorker take some time to perform, but in some edge cases it finishes pretty quickly, in this case the on_success/on_complete is never called.

nglx commented 5 years ago

@jonathanbruno Is there a chance that you could check if that's working in the latest master branch?

dennyluan commented 4 years ago

@jonathanbruno do you know if this was still happening for you, or if it was resolved? I'm finding occasional cases where this is true for me.

github-actions[bot] commented 4 years ago

Stale issue message