Laravel 5.7 : Supervisorctl does not auto-restart queue worker with

那年仲夏 提交于 2019-12-13 03:56:26

问题


I have supervisor for managing queue notifications as suggested in the laravel documentation . I have configured the supervisor as per the documentation and here is my configuration file.

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/application/artisan queue:work --tries=3
autostart=true
autorestart=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/application/storage/logs/worker/worker.log

This works fine but the problem is after sometime all the workers stops and doesn't restart even though there is pending jobs to be completed.

I need to manually restart the supervisor using sudo supervisorctl start laravel-worker:*.

How can this be resolved ?

Supervisorctl does not auto-restart daemon queue worker when hanging This is similar problem but the solution given there is the same thing i am using here.

Can anyone please help ?


回答1:


You could use horizon. horizon handles all this for you. https://laravel.com/docs/5.8/horizon

Example supervisor script for horizon:

[program:horizon]
process_name=%(program_name)s
command=php /var/www/application/artisan horizon
autostart=true
autorestart=true
user=root
redirect_stderr=true
stdout_logfile=/var/www/application/storage/logs/horizon.log

Also add this command to your deploy-process:

php artisan horizon:terminate

No need to restart it, supervisor does that for you.



来源:https://stackoverflow.com/questions/56260243/laravel-5-7-supervisorctl-does-not-auto-restart-queue-worker-with

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!