改名
This commit is contained in:
@@ -11,7 +11,7 @@ use Kiri\Abstracts\Config;
|
||||
use Kiri\Error\LoggerProcess;
|
||||
use Kiri\Events\EventDispatch;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Rpc\Service;
|
||||
use Kiri\Rpc\RpcProvider;
|
||||
use Server\Events\OnShutdown;
|
||||
use Swoole\Runtime;
|
||||
|
||||
@@ -75,7 +75,7 @@ class Server extends HttpService
|
||||
|
||||
$rpcService = Config::get('rpc', []);
|
||||
if (!empty($rpcService)) {
|
||||
Service::addRpcListener($this->manager, $rpcService);
|
||||
RpcProvider::addRpcListener($this->manager, $rpcService);
|
||||
}
|
||||
|
||||
$processes = array_merge($this->process, Config::get('processes', []));
|
||||
|
||||
@@ -49,10 +49,10 @@ class OnServerWorker extends \Server\Abstracts\Server
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $workerId
|
||||
* @throws \Exception
|
||||
*/
|
||||
/**
|
||||
* @param OnBeforeWorkerStart $worker
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setConfigure(OnBeforeWorkerStart $worker)
|
||||
{
|
||||
ServerManager::setEnv('worker', $worker->workerId);
|
||||
|
||||
@@ -19,25 +19,32 @@ class OnWorkerStart implements EventDispatcherInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var Annotation
|
||||
*/
|
||||
#[Inject(Annotation::class)]
|
||||
public Annotation $annotation;
|
||||
|
||||
|
||||
/**
|
||||
* @var Router
|
||||
*/
|
||||
#[Inject(Router::class)]
|
||||
public Router $router;
|
||||
|
||||
|
||||
/**
|
||||
* @param object $event
|
||||
* @return object|void
|
||||
* @throws \Kiri\Exception\ConfigException
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
/**
|
||||
* @param object $event
|
||||
* @return void
|
||||
* @throws ConfigException
|
||||
* @throws ReflectionException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function dispatch(object $event)
|
||||
{
|
||||
$isWorker = $event->workerId < $event->server->setting['worker_num'];
|
||||
|
||||
$this->annotation->read(APP_PATH . 'app', 'App', $isWorker ? [] : [CONTROLLER_PATH]);
|
||||
$this->annotation->read(APP_PATH . 'app', 'App');
|
||||
$this->interpretDirectory();
|
||||
if ($isWorker) {
|
||||
ServerManager::setEnv('environmental', Kiri::WORKER);
|
||||
|
||||
Reference in New Issue
Block a user