Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative pending on some batches #90

Open
betelgeus13 opened this issue Apr 28, 2024 · 1 comment
Open

Negative pending on some batches #90

betelgeus13 opened this issue Apr 28, 2024 · 1 comment

Comments

@betelgeus13
Copy link

betelgeus13 commented Apr 28, 2024

We used this gem to handle batches.

For some batches the success callback does not run, I checked those batches and the pending is negative. Any idea why the pending is negative?

This is what we get from redis

{"description"=>"Description", "created_at"=>"1714276864.5737576", "pending"=>"-9913", "children"=>"0", "total"=>"9913"}

I checked the code and the success/complete callback runs when pending is 0.

@betelgeus13
Copy link
Author

After some debugging found the reason for negative pending.

If a job is scheduled inside the batch. job, it will trigger a process_successful_job

So you have

batch.do 
  FirstJob.perfom_async
end


class FirstJob
  include Sidekiq::Worker

  def perform
    SecondJob.perform_async 
  end
end

process_successful_job will be called after FirstJob and after SecondJob, while only the FirstJob is added to pending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant