diff --git a/src/grpc-client/src/BaseClient.php b/src/grpc-client/src/BaseClient.php index f1b185905..976cc0186 100644 --- a/src/grpc-client/src/BaseClient.php +++ b/src/grpc-client/src/BaseClient.php @@ -27,7 +27,7 @@ use InvalidArgumentException; */ class BaseClient { - /** + /** * @var null|GrpcClient */ private $grpcClient; diff --git a/src/grpc-client/src/GrpcClient.php b/src/grpc-client/src/GrpcClient.php index bab807eb5..43bdff168 100644 --- a/src/grpc-client/src/GrpcClient.php +++ b/src/grpc-client/src/GrpcClient.php @@ -331,8 +331,6 @@ class GrpcClient } // Force close. if ($this->waitStatus === Status::WAIT_CLOSE_FORCE) { - $this->channelPool->release($this->recvChannelMap[$streamId]); - unset($this->recvChannelMap[$streamId]); if ($this->closeRecv()) { break; } diff --git a/src/grpc-client/tests/BaseClientTest.php b/src/grpc-client/tests/BaseClientTest.php index 0f1c331d8..636ca9bb8 100644 --- a/src/grpc-client/tests/BaseClientTest.php +++ b/src/grpc-client/tests/BaseClientTest.php @@ -50,6 +50,14 @@ class BaseClientTest extends TestCase self::$server->start(); }); } + + public static function tearDownAfterClass() + { + Coroutine::create(function () { + self::$server->shutdown(); + }); + } + public function setUp() { if (swoole_version() === '4.4.14') { @@ -65,13 +73,6 @@ class BaseClientTest extends TestCase parent::tearDown(); } - public static function tearDownAfterClass() - { - Coroutine::create(function () { - self::$server->shutdown(); - }); - } - public function testGrpcClientConnectionFailure() { $this->getContainer(); @@ -135,9 +136,9 @@ class BaseClientTest extends TestCase { $this->getContainer(); $client = new HiClient('127.0.0.1:2222', ['retry_attempts' => 0]); - try{ + try { $client->sayBug(); - } catch(TypeError $e){ + } catch (TypeError $e) { $this->assertNotNull($e); } finally { $this->assertGreaterThan(0, $client->sayHello()); diff --git a/src/grpc-client/tests/Stub/HiClient.php b/src/grpc-client/tests/Stub/HiClient.php index d84436581..d91a82de0 100644 --- a/src/grpc-client/tests/Stub/HiClient.php +++ b/src/grpc-client/tests/Stub/HiClient.php @@ -26,6 +26,7 @@ class HiClient extends BaseClient [UserReply::class, 'decode'] ); } + public function sayBug() { return $this->simpleRequest(