Wait until old workers finish processing all jobs still stored in the old connection and then stop those workers.Start new workers to process jobs from the new connection.Update your code to push new jobs to that connection.Configure a new queue connection in your queue.php configuration file for the new driver. Gracefully SwitchingĪnother approach is to follow these steps: You're basically going to stop the world for a bit. With this approach, your application will have a downtime until the workers empty the queue. Otherwise, they'll just pause and wait for the application to be back up. You should also disable the scheduler-by deactivating the CRON job-if any of your scheduled commands enqueue jobs.įinally, you should start your workers with the -force option so they continue processing jobs while the application is in maintenance mode. While in maintenance mode, a Laravel application will return a 503 response on every request, preventing visitors from taking any action that could enqueue more jobs. One way of doing this-and it's the most popular in the forum threads-is to put the application in maintenance mode, wait for the queue to be emptied, deploy the new driver, and then bring the application up. In this post we're going to look into the possible ways to switch between drivers. Each of the queue drivers supported by Laravel has its pros and cons, and sometimes you may want to switch between drivers to accommodate business needs.
0 Comments
Leave a Reply. |