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?
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