Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel queue job doesn't updates to the latest code

I am using a laravel queue job to send emails with an excel attachment. And many a time it is happening, that whenever I update any code change, it doesn't consider the updated code, rather it runs the old code. How can I prevent this?

like image 704
Nitish Patra Avatar asked Oct 22 '18 13:10

Nitish Patra


People also ask

How do I know if my Laravel queue is working?

Show activity on this post. This is lower level but in the same vein you could run a command such as ps -aux | grep queue to literally view the running queue processes on whatever server your application/queue workers are running on.

What is Laravel queue sync?

Sync, or synchronous, is the default queue driver which runs a queued job within your existing process. With this driver enabled, you effectively have no queue as the queued job runs immediately.

Are Laravel jobs asynchronous?

Laravel Jobs are not asynchronous.

What is the difference between job and queue in Laravel?

Jobs and Queues The line itself is the Queue, and each customer in the line is a Job. In order to process Jobs in the Queue you need command line processes or daemons. Think of launching a queue daemon on the command line as adding a new bank teller to the pool of available bank tellers.


1 Answers

Each time you deploy your Laravel app, or make any code change, you should run:

php artisan queue:restart

Of course make sure that in Supervisor you have set autostart to true.

You can read on https://laravel.com/docs/5.4/queues#running-the-queue-worker :

Since queue workers are long-lived processes, they will not pick up changes to your code without being restarted. So, the simplest way to deploy an application using queue workers is to restart the workers during your deployment process. You may gracefully restart all of the workers by issuing the queue:restart

like image 100
Marcin Nabiałek Avatar answered Oct 15 '22 02:10

Marcin Nabiałek