GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - breamware/sidekiq-batch: Sidekiq Batch Jobs Implementation

BranchesTags
Open more actions menu

Latest commit

 

History

169 Commits
169 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
lib/sidekiq
lib/sidekiq
 
 
spec
spec
 
 
.gitignore
.gitignore
 
 
.rspec
.rspec
 
 
Gemfile
Gemfile
 
 
Guardfile
Guardfile
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
Rakefile
Rakefile
 
 
compose.yml
compose.yml
 
 
sidekiq-batch.gemspec
sidekiq-batch.gemspec
 
 

Repository files navigation

Sidekiq::Batch

Join the chat at https://gitter.im/breamware/sidekiq-batch

Gem Version CI

Simple Sidekiq Batch Job implementation.

Installation

Add this line to your application's Gemfile:

gem 'sidekiq-batch'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sidekiq-batch

Usage

Sidekiq Batch is MOSTLY a drop-in replacement for the API from Sidekiq PRO. See https://github.com/mperham/sidekiq/wiki/Batches for usage.

Caveats/Gotchas

Consider the following workflow:

  • Batch Z created
  • Worker A queued in batch Z
  • Worker A starts Worker B in batch Z
  • Worker B completes before worker A does
  • Worker A completes

In the standard configuration, the on(:success) and on(:complete) callbacks will be triggered when Worker B completes. This configuration is the default, simply for legacy reasons. This gem adds the following option to the sidekiq.yml options:

:batch_push_interval: 0

When this value is absent (aka legacy), Worker A will only push the increment of batch jobs (aka Worker B) when it completes

When this value is set to 0, Worker A will increment the count as soon as WorkerB.perform_async is called

When this value is a positive number, Worker A will wait a maximum of value-seconds before pushing the increment to redis, or until it's done, whichever comes first.

This comes into play if Worker A is queueing thousands of WorkerB jobs, or has some other reason for WorkerB to complete beforehand.

If you are queueing many WorkerB jobs, it is recommended to set this value to something like 3 to avoid thousands of calls to redis, and call WorkerB like so:

WorkerB.perform_in(4.seconds, some, args)

this will ensure that the batch callback does not get triggered until WorkerA and the last WorkerB job complete.

If WorkerA is just slow for whatever reason, setting to 0 will update the batch status immediately so that the callbacks don't fire.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/breamware/sidekiq-batch.

License

The gem is available as open source under the terms of the MIT License.

About

Sidekiq Batch Jobs Implementation

Topics

batchsidekiqsidekiq-batch

Resources

Readme
MIT license
Activity
Custom properties

Stars

369 stars

Watchers

5 watching

Forks

101 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.