I scheduled a big queue with VBO, but I changed my mind. How can I delete it? I don't seem to find any UI/interface to manage queues. Do I have to delete it in the database?
There's no built-in management UI for queues in Drupal but if you're looking for a one check out the Queue UI module.
To delete a queue in your code use
drush has no option to clear queues, there is just
drush queue-list and
drush queue-run. However, you can use it to delete the corresponding queue records from the database:
drush queue-listto find out the name of the queue you want to clear. In my case, it is
Use a command like this, replacing with your queue's name accordingly:
drush sqlq "DELETE FROM queue WHERE name='message_subscribe'"
drush queue-listthat the queue in question now has zero items in it.
This solution is quite similar to @batigolix's, just that it clears a specific queue instead of all queues.
Careful. Like @batigolix said, take care not to lose data! This solution might not be for a production environment …
Yes, you can delete or clear a queue in the database by emptying the queue table.
Drush allows you to do that easily with
drush sqlq "TRUNCATE queue".
Careful. I tried this in a local development environment. It may not be recommended in production.
Emptying the entire
queue table is not always a good idea as it contains items from queues created by other modules as well. So, a cleaner way is to remove items from a particular queue.
- First, inspect the queues which exist in the
queuetable by browsing the table using
phpmyadmin. To get all queue names with some items in the queue, you can do
SELECT DISTINCT name FROM queue.
- Second, once you've decided upon the queue you want to empty, remove items only for that queue using
DELETE FROM queue WHERE name = :name. Replace `:name: with the name of the queue you found in the first step.
I've used this on production, but you should be careful and use your judgement. In short, best thing is to not delete stuff from other module's queue or queues you don't know the purpose of.