On changing Listener code its not changing. Laravel always using cached code.
I am sending Mails in queues via events and listener. But whenever i change some code in my Listener file is not getting deducted by laravel. It is always using the old cached version of code i think.
Because when i change the filename, the new code works. But when i make change and dont rename the file. it didnt detect that my code is being changed.
I also tried using php artisan cache:clear but no luck
Thanx @martinbean. restarting the worker but. do you know how can i auto restart it everytime i make a file change ?
I am using pm2 process to keep track of queue jobs.
@princeparaste I have no idea what that package is. I’ve never used it.
You need to restart the worker each time you make a code change because the queue worker process loads the application into memory. So changing code does not change what’s in memory for the running process.
It automatically starts when i php artisan serve
Please tell me you’re not using php artisan serve to serve your application in a production environment…?
@martinbean No i am not, 😂 I am just using that cmd in my Local. This queue worker method is effective to send mail in queue.
But i don't know what will happen if some other developer will code on my project. He might not know pm2 process needs to be restart everytime the file change.
Alternatively, you may run the queue:listen command. When using the queue:listen command, you don't have to manually restart the worker when you want to reload your updated code or reset the application state; however, this command is significantly less efficient than the queue:work command: