workerman 平滑重启

<?php
use Workerman\Worker;
use Workerman\Lib\Timer; require_once '../../web/Workerman/Autoloader.php';
require_once '../../web/Channel/src/Client.php'; $worker = new Worker('http://0.0.0.0:8989');
$worker->count = 4;
$worker->reloadable = false; //平滑重启
$worker->onWorkerStart = function ($worker)
{
if ($worker->id == 0) {
Timer::add(1, function(){
require './time.php'; //平滑重启只会对on回调函数的require的业务代码生效 执行命令php xmpp.php reload
echo $a;
});
}
}; Worker::runAll();
上一篇:Java多线程编程核心技术-第5章-定时器 Timer-读书笔记


下一篇:Python判断内网IP