Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6926a636b4 | |||
| fe09da4a97 | |||
| cab1ed999a | |||
| 349e07b12c | |||
| 5fb1f0fc99 | |||
| 524d2b8664 | |||
| f4a5a4dbee | |||
| af613784fd |
@@ -117,6 +117,9 @@ class RpcJsonp extends Component implements OnConnectInterface, OnReceiveInterfa
|
|||||||
return $server->send($fd, $this->batchDispatch($data), $reactor_id);
|
return $server->send($fd, $this->batchDispatch($data), $reactor_id);
|
||||||
} catch (\Throwable $throwable) {
|
} catch (\Throwable $throwable) {
|
||||||
$response = Json::encode($this->failure(-32700, $throwable->getMessage()));
|
$response = Json::encode($this->failure(-32700, $throwable->getMessage()));
|
||||||
|
|
||||||
|
$this->getLogger()->json_log($throwable);
|
||||||
|
|
||||||
return $server->send($fd, $response, $reactor_id);
|
return $server->send($fd, $response, $reactor_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-12
@@ -3,11 +3,12 @@
|
|||||||
namespace Kiri\Rpc;
|
namespace Kiri\Rpc;
|
||||||
|
|
||||||
use Kiri\Di\Context;
|
use Kiri\Di\Context;
|
||||||
use Kiri\Server\Abstracts\BaseProcess;
|
use Kiri\Server\Processes\AbstractProcess;
|
||||||
use Swoole\Coroutine;
|
use Swoole\Coroutine;
|
||||||
use Swoole\Process;
|
use Swoole\Process;
|
||||||
|
use function pcntl_signal;
|
||||||
|
|
||||||
class RpcProcess extends BaseProcess
|
class RpcProcess extends AbstractProcess
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@@ -31,17 +32,9 @@ class RpcProcess extends BaseProcess
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -9,11 +9,11 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.0",
|
"php": ">=8.5",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-msgpack": "*",
|
"ext-msgpack": "*",
|
||||||
"start-point/etcd-php": "^1.1",
|
"start-point/etcd-php": "^1.1",
|
||||||
"game-worker/kiri-pool": "~v1.0",
|
"game-worker/kiri-pool": "^v1.0",
|
||||||
"linkorb/etcd-php": "^1.6"
|
"linkorb/etcd-php": "^1.6"
|
||||||
},
|
},
|
||||||
"replace": {
|
"replace": {
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ return [
|
|||||||
"check" => [
|
"check" => [
|
||||||
"node" => "t2.320",
|
"node" => "t2.320",
|
||||||
"checkId" => "service:redis1",
|
"checkId" => "service:redis1",
|
||||||
"name" => "Redis health check",
|
"name" => "NoSql health check",
|
||||||
"Annotations" => "Script based health check",
|
"Annotations" => "Script based health check",
|
||||||
"status" => "passing",
|
"status" => "passing",
|
||||||
"serviceID" => "redis1",
|
"serviceID" => "redis1",
|
||||||
|
|||||||
Reference in New Issue
Block a user