This commit is contained in:
2023-12-12 15:35:34 +08:00
parent 4ebb7e9686
commit 92e65c4abd
15 changed files with 362 additions and 391 deletions
+16 -17
View File
@@ -13,23 +13,22 @@ class OnPipeMessage extends Server
{
/**
* @param \Swoole\Server $server
* @param int $src_worker_id
* @param mixed $message
* @throws Exception
*/
public function onPipeMessage(\Swoole\Server $server, int $src_worker_id, mixed $message): void
{
if (is_string($message)) {
$message = unserialize($message);
}
if (!is_object($message) || !($message instanceof OnPipeMessageInterface)) {
return;
}
call_user_func([$message, 'process'], $server, $src_worker_id);
}
/**
* @param \Swoole\Server $server
* @param int $src_worker_id
* @param mixed $message
* @throws
*/
public function onPipeMessage(\Swoole\Server $server, int $src_worker_id, mixed $message): void
{
if (is_string($message)) {
$message = unserialize($message);
}
if (!is_object($message) || !($message instanceof OnPipeMessageInterface)) {
return;
}
call_user_func([$message, 'process'], $server, $src_worker_id);
}
}
+2 -4
View File
@@ -61,9 +61,7 @@ class OnRequest implements OnRequestInterface
* @param ResponseInterface $response
* @param ContainerInterface $container
* @param DataGrip $dataGrip
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws
*/
public function __construct(public ResponseInterface $response, public ContainerInterface $container,
public DataGrip $dataGrip)
@@ -81,7 +79,7 @@ class OnRequest implements OnRequestInterface
/**
* @param Request $request
* @param Response $response
* @throws Exception
* @throws
*/
public function onRequest(Request $request, Response $response): void
{
+2 -2
View File
@@ -31,7 +31,7 @@ class OnServer extends Server
/**
* @param SServer $server
* @throws ReflectionException
* @throws
*/
public function onStart(SServer $server): void
{
@@ -45,7 +45,7 @@ class OnServer extends Server
/**
* @param SServer $server
* @throws ReflectionException
* @throws
*/
public function onBeforeShutdown(SServer $server): void
{
+18 -18
View File
@@ -17,27 +17,27 @@ class OnServerManager extends Server
{
/**
* @param \Swoole\Server $server
* @throws ReflectionException
*/
public function onManagerStart(\Swoole\Server $server): void
{
Kiri::setProcessName(sprintf('manger process[%d]', $server->manager_pid));
/**
* @param \Swoole\Server $server
* @throws
*/
public function onManagerStart(\Swoole\Server $server): void
{
Kiri::setProcessName(sprintf('manger process[%d]', $server->manager_pid));
event(new OnManagerStart($server));
}
event(new OnManagerStart($server));
}
/**
* @param \Swoole\Server $server
* @return void
* @throws ReflectionException
*/
public function onManagerStop(\Swoole\Server $server): void
{
event(new OnManagerStop($server));
}
/**
* @param \Swoole\Server $server
* @return void
* @throws
*/
public function onManagerStop(\Swoole\Server $server): void
{
event(new OnManagerStop($server));
}
}
+5 -5
View File
@@ -64,7 +64,7 @@ class OnServerWorker extends \Kiri\Server\Abstracts\Server
* @param Server $server
* @param int $workerId
* @return void
* @throws Exception
* @throws
*/
public function onWorkerStart(Server $server, int $workerId): void
{
@@ -92,7 +92,7 @@ class OnServerWorker extends \Kiri\Server\Abstracts\Server
/**
* @param Server $server
* @param int $workerId
* @throws ReflectionException
* @throws
*/
public function onWorkerStop(Server $server, int $workerId): void
{
@@ -104,7 +104,7 @@ class OnServerWorker extends \Kiri\Server\Abstracts\Server
/**
* @param Server $server
* @param int $workerId
* @throws ReflectionException
* @throws
*/
public function onWorkerExit(Server $server, int $workerId): void
{
@@ -118,7 +118,7 @@ class OnServerWorker extends \Kiri\Server\Abstracts\Server
* @param int $worker_pid
* @param int $exit_code
* @param int $signal
* @throws Exception
* @throws
*/
public function onWorkerError(Server $server, int $worker_id, int $worker_pid, int $exit_code, int $signal): void
{
@@ -135,7 +135,7 @@ class OnServerWorker extends \Kiri\Server\Abstracts\Server
/**
* @param $messageContent
* @throws Exception
* @throws
*/
protected function system_mail($messageContent): void
{