eee
This commit is contained in:
+5
-12
@@ -5,6 +5,7 @@ namespace Kiri\Rpc;
|
|||||||
use Kiri\Di\Context;
|
use Kiri\Di\Context;
|
||||||
use Kiri\Server\Processes\AbstractProcess;
|
use Kiri\Server\Processes\AbstractProcess;
|
||||||
use Swoole\Coroutine;
|
use Swoole\Coroutine;
|
||||||
|
use Swoole\Process;
|
||||||
use function pcntl_signal;
|
use function pcntl_signal;
|
||||||
|
|
||||||
class RpcProcess extends AbstractProcess
|
class RpcProcess extends AbstractProcess
|
||||||
@@ -21,27 +22,19 @@ class RpcProcess extends AbstractProcess
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Swoole\Process|null $process
|
* @param Process|null $process
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function process(?\Swoole\Process $process): void
|
public function process(?Process $process): void
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return $this
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function onSigterm(): static
|
public function onSigterm(): void
|
||||||
{
|
{
|
||||||
// TODO: Implement onSigterm() method.
|
|
||||||
if (Context::inCoroutine()) {
|
|
||||||
Coroutine::create(fn() => $this->onShutdown(Coroutine::waitSignal(SIGTERM | SIGINT)));
|
|
||||||
} else {
|
|
||||||
pcntl_signal(SIGTERM, [$this, 'onStop']);
|
|
||||||
pcntl_signal(SIGINT, [$this, 'onStop']);
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user