7

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?

11

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 $queue->deleteQueue();

12

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:

  1. Use drush queue-list to find out the name of the queue you want to clear. In my case, it is message_subscribe.

  2. Use a command like this, replacing with your queue's name accordingly:

    drush sqlq "DELETE FROM queue WHERE name='message_subscribe'"
    
  3. Confirm with drush queue-list that 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 …

5

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 queue table by browsing the table using mysql or 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.