<?php
namespace app\admin\controller;
use GatewayWorker\BusinessWorker;
use Workerman\Worker;
//require '../extend/GlobalData-master/src/Client.php';
class GateWayBusinessWorker
{
public function index()
{
//businessWorker 进程
$worker = new BusinessWorker();
//worker 名称
$worker->name = 'TpWorkBusinessWorker';
$worker->count = Cfg::tp_business_count;
// 服务注册地址
$worker->registerAddress = '127.0.0.1:' . Cfg::tp_register_port;
$worker->eventHandler = '\app\admin\controller\GateWayEvents';
//分类:log
$worker_log = new BusinessWorker();
$worker_log->name = 'TpWorkBusinessWorker_log';
$worker_log->count = 1;
$worker_log->registerAddress = '127.0.0.1:' . Cfg::tp_log_register_port;
$worker_log->eventHandler = '\app\admin\controller\GateWayEventsLog';
// 如果不是在根目录启动,则运行 runAll 方法
if ( !defined( 'TP_GLOBAL_START' ) ) {
// 启用swoole的事件驱动
Worker::$eventLoopClass = 'Workerman\Events\Swoole';
Worker::runAll();
}
}
}
启动后是这样的,这样放一起会不会影响性能,还是分开启动好?
没看懂,这是什么骚操作
我也没看懂,为什么有这种操作
这么做的目的是什么
这么做的目的是什么