Thyda Eng
Thyda Eng

Reputation: 145

Delete all scheduled task in Sidekiq

I am working with rails and have the bunch of schedule tasks running on sidekiq, and anyway I want to delete all of that tasks from schedule list. I was wonder whether is there any command with rails I can run to clear all those stuff ?

Upvotes: 6

Views: 7487

Answers (3)

ian root
ian root

Reputation: 349

Neither of the listed solutions worked for me so I had to shut down redis-server and sidekiq and delete the dump.rdb file. Keep in mind, doing this will delete all queues, all the retries, and the lists of processed, failed and dead jobs.

Upvotes: 0

Andrey Deineko
Andrey Deineko

Reputation: 52357

There is. Given that your queue is called "my_queue":

require 'sidekiq/api'
Sidekiq::ScheduledSet.new("my_queue").clear

Check out Sidekiq API.

Upvotes: 14

Aleks
Aleks

Reputation: 5330

The accepted answer didn't work for me. What I did to clear the queue was:

Sidekiq::ScheduledSet.new.clear

If you need clearing the scheduled queue, you might need also clearing other queues:

Sidekiq::RetrySet.new.clear
Sidekiq::Queue.new("your_queue_name").clear
Sidekiq::Queue.all.each(&:clear)

Upvotes: 12

Related Questions