Clear Laravel Queue Cache without restarting

13,485

Solution 1

you will have not cache if you use code:

php artisan queue:listen

Also, interest command:

php artisan queue:work --queue=system,hot,default --tries=10 --timeout=10  --stop-when-empty

Solution 2

Open an extra terminal and use the artisan command

php artisan queue:restart

Solution 3

This command will instruct all queue workers to gracefully "die" after they finish processing their current job so that no existing jobs are lost.

You may gracefully restart all of the workers by issuing the queue:restart command:

php artisan queue:restart

source: https://laravel.com/docs/5.8/queues#running-the-queue-worker

so the full chain of commands should be (maybe) this:

composer dump-autoload
php artisan optimize
php artisan clear-compiled
php artisan cache:clear
php artisan view:clear
php artisan route:cache
php artisan queue:restart

I left out the config cache command on purpose because I don't want to run it initially. Running it, will actually start to cache your config file afaik so I dont want that.

I'm answering because I want to store my own answer to evernote, to never ever have to deal with that bs again

Share:
13,485
Assem
Author by

Assem

Updated on June 05, 2022

Comments

  • Assem
    Assem almost 2 years

    In my application, every customer has a kind of complex class in which we do some search and replaces for that specific customer. I run Queue workers to run a daily sync with eBay for every single customer to do some kind of search and replaces.

    The problem is Laravel queues caches the code for a good deal of time and if I want to go and change any customer class file (Which happens frequently), I will have to restart queue workers (Which may stop a running job that I don't intend to stop).

    So my question is, how to force Laravel Queue to reread the new code without restarting workers?