Sidekiq Schedulable
Schedule Cron style Sidekiq jobs
Usage
require 'sidekiq_schedulable'
class MyJob
include Sidekiq::Worker
include Sidekiq::Schedulable
sidekiq_options retry: false, queue: 'my_scheduled_jobs_queue'
sidekiq_schedule '*/5 * * * * *'
def perform
RunReport.call
end
end
Using the last run time:
class MyJob
include Sidekiq::Worker
include Sidekiq::Schedulable
sidekiq_options retry: false, queue: 'my_scheduled_jobs_queue'
sidekiq_schedule '*/5 * * * * *', last_run: true
def perform(last_run)
RunReport.between(Time.at(last_run), Time.now)
end
end