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