Skip to content

Scheduled Jobs

Mike Perham edited this page Aug 6, 2015 · 39 revisions

Sidekiq allows you to schedule the time when a job will be executed. You use perform_in(interval, *args) or perform_at(timestamp, *args) rather than the standard perform_async(*args):

MyWorker.perform_in(3.hours, 'mike', 1)
MyWorker.perform_at(3.hours.from_now, 'mike', 1)

This is useful for example if you want to send the user an email 3 hours after they sign up.

Checking for New Jobs

Sidekiq checks for scheduled jobs every 15 seconds by default. You can adjust this interval:

Sidekiq.configure_server do |config|
  config.average_scheduled_poll_interval = 15
end

Periodic Jobs

Sidekiq Enterprise supports periodic jobs. Other 3rd party gems also offer cron-like functionality.

Previous: Advanced Options Next: Delayed Extensions

Clone this wiki locally