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.
source 'http://rubygems.org'
gem 'sidekiq-scheduler', '~> 1'
require 'sidekiq-scheduler'
class HelloWorld
include Sidekiq::Worker
def perform
puts 'Hello world!'
end
end
:schedule:
hello_world:
every: 1m # Runs once per minute
class: HelloWorld
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