All Projects → dtaniwaki → sidekiq-merger

dtaniwaki / sidekiq-merger

Licence: MIT license
Merge Sidekiq jobs

Programming Languages

ruby
36898 projects - #4 most used programming language
HTML
75241 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to sidekiq-merger

Rocketjob
Ruby's missing background and batch processing system
Stars: ✭ 258 (+426.53%)
Mutual labels:  sidekiq, batch
Sidekiq Batch
Sidekiq Batch Jobs Implementation
Stars: ✭ 233 (+375.51%)
Mutual labels:  sidekiq, batch
rocketjob
Ruby's missing background and batch processing system
Stars: ✭ 281 (+473.47%)
Mutual labels:  sidekiq, batch
dataloader-dotnet
DataLoader for .NET
Stars: ✭ 40 (-18.37%)
Mutual labels:  batch
removd
Automatic ai cut outs of people, products and cars with https://www.remove.bg service
Stars: ✭ 28 (-42.86%)
Mutual labels:  batch
scott
💼 The Podcast Regional Manager
Stars: ✭ 21 (-57.14%)
Mutual labels:  sidekiq
Bat2Exe
Windows user interface for converting your batch files into executables.
Stars: ✭ 60 (+22.45%)
Mutual labels:  batch
sidecloq
Recurring / Periodic / Scheduled / Cron job extension for Sidekiq
Stars: ✭ 81 (+65.31%)
Mutual labels:  sidekiq
EFT Flea Market Bot
Escape from Tarkov Flea Market bot, to generate a lot of in-game currency within shortest time, while not even having to actively play the game!
Stars: ✭ 22 (-55.1%)
Mutual labels:  batch
cl-rashell
Resilient replicant Shell Programming Library for Common Lisp
Stars: ✭ 17 (-65.31%)
Mutual labels:  batch
sidekiq-sequence
Sequential Sidekiq jobs for Rails
Stars: ✭ 38 (-22.45%)
Mutual labels:  sidekiq
modern-rails-flash-messages
Modern Rails flash messages - Example App
Stars: ✭ 21 (-57.14%)
Mutual labels:  sidekiq
gobatch
Batch processing library for Golang.
Stars: ✭ 19 (-61.22%)
Mutual labels:  batch
SZTElectronicInvoice
深圳通充值发票手动、自动批量下载程序【代码仅供学习,请勿非法使用,违者一概不负责任】
Stars: ✭ 17 (-65.31%)
Mutual labels:  batch
Batched-Grabber
🖥️ Windows Batch and powershell Discord Token grabber. Made for Troll (lmao)
Stars: ✭ 39 (-20.41%)
Mutual labels:  batch
batch-transforms
Batch equivalent of PyTorch Transforms.
Stars: ✭ 33 (-32.65%)
Mutual labels:  batch
svg2vector
Online batch converter of SVG images to Android vector drawable XML resource files
Stars: ✭ 39 (-20.41%)
Mutual labels:  batch
sidekiq-prometheus
Public repository with Prometheus instrumentation for Sidekiq
Stars: ✭ 56 (+14.29%)
Mutual labels:  sidekiq
rails async migrations
Asynchronous support for ActiveRecord::Migration
Stars: ✭ 56 (+14.29%)
Mutual labels:  sidekiq
KJNetworkPlugin
🎡A lightweight but powerful Network library. Network Plugin, Support batch and chain operation. 插件版网络架构
Stars: ✭ 43 (-12.24%)
Mutual labels:  batch

sidekiq-merger

Gem Version Dependency Status Build Status Coverage Status Code Climate

Docker

Merge sidekiq jobs occurring before the execution times. Inspired by sidekiq-grouping.

Demo

Use Case

Cancel Task

Cancel Task

Bulk Notification

Bulk Notification

Installation

Add this line to your application's Gemfile:

gem 'sidekiq-merger'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sidekiq-merger

Usage

Add merger option into your workers.

class SomeWorker
  include Sidekiq::Worker

  sidekiq_options merger: { key: -> (args) { args[0] } }

  def perform(*merged_args)
    merged_args.each do |args|
      # Do something
    end
  end
end

Then, enqueue jobs by perform_in or perform_at.

SomeWorker.perform_in 100, 4
SomeWorker.perform_in 100, 3
SomeWorker.perform_in 100, 5
# Passed 100 seconds from the first enqueue.
SomeWorker.perform_in 100, 6
SomeWorker.perform_in 100, 1

SomeWorker will be executed in 100 seconds with args of [4], [3], [5], then with args of [6], [1].

perform_async works without merging args.

SomeWorker.perform_async 4
SomeWorker.perform_async 3
SomeWorker.perform_async 5

In this case, SomeWorker will be executed 3 times with args of [4], [3] and [5].

Quick Check

Run docker containers to check the behavior of this gem.

$ docker-compose up

Then, open http://localhost:3000/. You can push jobs from the UI and see what happens in the sidekiq console.

Options

key (optional, default: nil)

Defines merge key so different arguments can be merged.

Format: String or Proc

e.g. sidekiq_options merger: { key: -> (args) { args[0..1] } }

unique (optional, default: false)

Prevents enqueue of jobs with identical arguments.

Format: Boolean

e.g. true

batch_size (optional, default: nil)

Allow to specify how many jobs max to provide as arguments per aggregation

Format: Int

e.g. 50

Web UI

Web UI

Add this line to your config/routes.rb to activate web UI:

require "sidekiq/merger/web"

Test

$ bundle exec appraisal rspec

The test coverage is available at ./coverage/index.html.

Lint

$ bundle exec appraisal rubocop

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright

Copyright (c) 2017 dtaniwaki. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].