Lightweight job scheduler extension for Sidekiq
Fork me on GitHub

Why Sidekiq Scheduler

SidekiqScheduler is an extension to sidekiq that allows you to schedule jobs to run at a given time or at certain intervals, e.g. every day at 8 pm. You can use cron syntax or “every: X day” syntax.

Install

~gem install sidekiq-scheduler
or
  • Gemfile
source 'http://rubygems.org'

gem 'sidekiq-scheduler', '~> 1'

Using

  • hello-scheduler.rb
require 'sidekiq-scheduler'

class HelloWorld
  include Sidekiq::Worker

  def perform
    puts 'Hello world!'
  end
end
  • config/sidekiq.yml
:schedule:
  hello_world:
    every: 1m   # Runs once per minute
    class: HelloWorld
~sidekiq -r ./hello-scheduler.rb
Booting Sidekiq 4.2.10 with redis options {:url=>nil}

Scheduling hello_world {"every"=>"1m", "class"=>"HelloWorld", "queue"=>"default"}

Starting processing, hit Ctrl-C to stop
queueing HelloWorld (hello_world)
HelloWorld ... start

Hello world!

HelloWorld ... done: 0.001 sec