turing_machine
turing_machine

Reputation: 473

Prevent sidekiq from executing queued up jobs when starting from command line?

When I start sidekiq in my development environment (Rails 3.2), I use the following command:

bundle exec sidekiq

When I do this, sidekiq will execute all jobs that have been queued up when it was not running. e.g. If I have created a bunch of new user accounts during testing, it will try and send welcome emails to all of the fake accounts (my emails are sent from a sidekiq job).

Is there a way to start sidekiq and tell it to delete all pending jobs? That way I can turn it back on without worrying that it will try and run a bunch of jobs that don't need to run (since this is my dev environment).

I have looked in documentation, but can't find an answer, hopefully it's something simple I overlooked...

Upvotes: 2

Views: 1185

Answers (2)

Mike Perham
Mike Perham

Reputation: 22228

redis-cli flushall && bundle exec sidekiq

Upvotes: 2

turing_machine
turing_machine

Reputation: 473

I found a solution: Using the sidekiq monitoring UI that comes with sidekiq (https://github.com/mperham/sidekiq/wiki/Monitoring), I'm able to view all queues (even when sidekiq is not running). Deleting the queue will remove all of the jobs in it, which solves the problem.

enter image description here

Upvotes: 1

Related Questions