变更
This commit is contained in:
+10
@@ -22,6 +22,7 @@ use Psr\Container\ContainerInterface;
|
|||||||
use Psr\Container\NotFoundExceptionInterface;
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
use ReflectionException;
|
use ReflectionException;
|
||||||
use Swoole\Coroutine;
|
use Swoole\Coroutine;
|
||||||
|
use Kiri\Server\Events\OnBeforeShutdown;
|
||||||
use Kiri\Events\EventProvider;
|
use Kiri\Events\EventProvider;
|
||||||
use Kiri\Server\Events\OnWorkerStart;
|
use Kiri\Server\Events\OnWorkerStart;
|
||||||
|
|
||||||
@@ -124,6 +125,15 @@ class Server extends HttpService
|
|||||||
$this->onWorkerStart();
|
$this->onWorkerStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pcntl_signal(SIGINT, function () {
|
||||||
|
try {
|
||||||
|
$this->eventDispatch->dispatch(new OnBeforeShutdown());
|
||||||
|
}catch (\Throwable $exception) {
|
||||||
|
$this->logger->error($exception->getMessage());
|
||||||
|
}
|
||||||
|
$this->manager->getServer()->shutdown();
|
||||||
|
});
|
||||||
|
|
||||||
$processes = array_merge($this->process, Config::get('processes', []));
|
$processes = array_merge($this->process, Config::get('processes', []));
|
||||||
|
|
||||||
$this->processManager->batch($processes);
|
$this->processManager->batch($processes);
|
||||||
|
|||||||
Reference in New Issue
Block a user