How to stop laravel scheduler gracefully during new deployment ?
I have 2 types of scheduled commands.
Short Job - Runs every 30 seconds (and takes 10 seconds to be completed)
Long Job - Runs Every hour (and takes 45 minutes to be completed)
I have configured CI\CD pipelines in different environments (AWS EC2, AWS Elastic Beanstalks, Azure Kubernetes, CPanel etc.) I have noticed various weird behaviours while deployment. Followings are some examples
Deployment got stuck because a long running job was executing.
Deployment successful but the running job execution broke and the scheduler started from next job after new deployment
What is the appropriate way to design the CI/CD so that the scheduler execution is not affected unexpectedly ?
We're using Supervisor and stop all queue workers when the deployment start, rereads en start again when deployment is done.
Although not tested with very long jobs, I think the jobs will be killed when supervisor stops. Of course you have to run them again if needed when the deployment is finished (or wait until the next cycle of acceptable).