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

What is the difference of batch_size and batch_flush_size? #21

Open
alfakini opened this issue Sep 22, 2016 · 1 comment
Open

What is the difference of batch_size and batch_flush_size? #21

alfakini opened this issue Sep 22, 2016 · 1 comment

Comments

@alfakini
Copy link

alfakini commented Sep 22, 2016

Sorry for asking this question, but it was not clear for me while reading the documentation. In the README says that:

NOTE: As of 1.0 batch_size renamed to batch_flush_size.

But them there is this exemple that uses both:

class FooWorker
  include Sidekiq::Worker

  sidekiq_options batch_flush_size: 5, batch_size: 2

  def perform(n)
    puts n
  end
end

And them looking in the code I can see that pluck_size and chunk_size are used in different places here https://github.com/gzigzigzeo/sidekiq-grouping/blob/master/lib/sidekiq/grouping/batch.rb#L27-L35

Could someone please clarify if they are different options of are the same?

Thanks!

@bjedrocha
Copy link

bjedrocha commented Dec 20, 2016

They are different options. batch_flush_size determines the size of the queue at which point grouping will occur. batch_size determines the size of each group.

In your example, grouping will occur when there a 5 or more jobs in the queue but because the batch_size is set to 2, the number of jobs in each group will be 2. Hope this answers your question.

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

2 participants