更改 Laravel 文件后,Supervisord 进程是否需要重新启动? [英] Does Supervisord process need restart after changes to Laravel file?

查看:122
本文介绍了更改 Laravel 文件后,Supervisord 进程是否需要重新启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Laravel 4.2 中使用 Supervisord 来监控队列.这是我的 Supervisord 配置文件:

I am using Supervisord to monitor a queue in Laravel 4.2. This is my Supervisord config file:

[program:webhooks]
command=php artisan queue:work --daemon --queue=webhooks --tries=3 --sleep=5
directory=/var/www/html/app
stdout_logfile=/var/www/html/app/app/storage/logs/webhooks_supervisord.log
redirect_stderr=true
autostart=true
autorestart=true

正如我在 Laravel 文档中看到的:

As I see in the Laravel docs:

守护进程队列工作者在处理前不重启框架每个工作.

Daemon queue workers do not restart the framework before processing each job.

据我所知,这意味着如果我对框架中的一个文件进行更改,该更改将不会反映在处理队列的守护进程中.例如,如果我的文件之一显示 echo 1; 而我更改为 echo 2;,则队列使用的框架版本仍会显示 echo 1,直到我重新启动队列.要使这些新更改生效,我需要运行:

From what I can tell, this means that if I make a change to one of the files in the framework, that change will not be reflected in the daemon processing the queue. For example, if one of my file says echo 1; and I change to echo 2;, the version of the framework that the queue is using will still say echo 1, until I restart the queue. To have these new changes take effect, I need to run:

sudo supervisorctl
supervisor> stop webhooks
supervisor> start webhooks

我是否正确地认为这是必需的?或者是否有另一种方法来处理这个问题,以便在不重新启动队列的情况下获取对文件的新更改?

Am I correct that this is required? Or is there another way to handle this so that new changes to the files will be picked up without restarting the queue?

推荐答案

你不需要!只需执行以下操作,supervisor 将自动使用新代码重新启动.

You dont need to! Just do the following and the supervisor will automatically restart with fresh code.

$> CD /your/project/folder
$> php artisan queue:restart

原因是 artisan 命令将停止队列,并且由于您在配置中设置了 autorestart=true,supervisor 将再次强制重新启动.

The reason is that the artisan command will stop the queue and supervisor will force a restart again as you have set autorestart=true in the config.

要确认,只需执行以下操作并查看输出中的 uptime:

To confirm, just do the following and see the uptime in the output:

$> sudo supervisorctl status

--

如果您对 supervisord 程序的配置进行了更改,还可以执行以下操作:

Additionally can do the following if you have made changes to the supervisord program's config:

$> sudo supervisorctl update

这将重新加载配置,根据需要添加/删除,并将重新启动受影响的主管程序

This will reload configs, add/remove as necessary, and will restart affected supervisor programs

这篇关于更改 Laravel 文件后,Supervisord 进程是否需要重新启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆