Vitalii Paprotskyi
Vitalii Paprotskyi

Reputation: 389

how to call sidekiq worker every times with certain duration of time between calls?

So I have a worker. I want him to start every 2 weeks to clean some data. How can I do this? I know about perform_in and perform_at but this is not what I need.

Upvotes: 1

Views: 1856

Answers (1)

Robert Nubel
Robert Nubel

Reputation: 7532

Scheduled, recurring jobs are not part of the core Sidekiq functionality. You can either upgrade to Sidekiq Pro, which includes support for scheduled jobs, or use an open-source scheduling plugin like sidekiq-scheduler.

With the latter, to run your job every two weeks, you'd use a config like:

your_job_name_here:
  every: 2w
  class: YourWorker
  queue: default
  description: "Runs every two weeks"

Upvotes: 3

Related Questions