eee
This commit is contained in:
+4
-3
@@ -3,9 +3,10 @@
|
|||||||
namespace Kiri\Rpc;
|
namespace Kiri\Rpc;
|
||||||
|
|
||||||
use Kiri\Di\Context;
|
use Kiri\Di\Context;
|
||||||
use Kiri\Server\Abstracts\BaseProcess;
|
use Kiri\Server\Processes\BaseProcess;
|
||||||
use Swoole\Coroutine;
|
use Swoole\Coroutine;
|
||||||
use Swoole\Process;
|
use Swoole\Process;
|
||||||
|
use function pcntl_signal;
|
||||||
|
|
||||||
class RpcProcess extends BaseProcess
|
class RpcProcess extends BaseProcess
|
||||||
{
|
{
|
||||||
@@ -39,8 +40,8 @@ class RpcProcess extends BaseProcess
|
|||||||
if (Context::inCoroutine()) {
|
if (Context::inCoroutine()) {
|
||||||
Coroutine::create(fn() => $this->onShutdown(Coroutine::waitSignal(SIGTERM | SIGINT)));
|
Coroutine::create(fn() => $this->onShutdown(Coroutine::waitSignal(SIGTERM | SIGINT)));
|
||||||
} else {
|
} else {
|
||||||
\pcntl_signal(SIGTERM, [$this, 'onStop']);
|
pcntl_signal(SIGTERM, [$this, 'onStop']);
|
||||||
\pcntl_signal(SIGINT, [$this, 'onStop']);
|
pcntl_signal(SIGINT, [$this, 'onStop']);
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user