为了处理大量的作业(job),我根据需要完成的工作量运行不同数量的队列工作人员.我不想让更多的工人在我们认为合适的时间内完成需要完成的工作.
At the moment, I start 5 daemon queue workers for testing purposes, however in production this number could be between 25 & 100 workers, possibly more. I understand that when deploying, I have to stop the queue workers by first placing the framework in maintenance mode by using php artisan down
, because the --daemon
flag causes the framework to only load when the worker starts up, hence new code would not take affect during the deploy until the worker restarts.
如果我出于某种原因需要停止工人,我可以使用php artisan down
将应用程序置于维护模式,这将导致工人在处理完当前工作后死亡(如果他们正在工作的话).然而,有时我可能想在不将整个应用程序置于维护模式的情况下杀死工人.
Is there a safe way to stop the workers in a way where they will continue processing their current job and then die without placing the whole application in maintenance mode?
Essentially what I need is a 100, which behaves like 101, but does not restart the worker once the job is done.
我曾希望有一个类似于php artisan queue:stop
的命令可以做到这一点,但事实似乎并非如此.
使用ps aux | grep php
,我能够获得进程ID的工人,我可以杀死进程的方式,但我不想杀死过程中的中间工作的一项工作.
Thanks.