diff --git a/Rpc/Client.php b/Rpc/Client.php index b98e2b6f..9047c870 100644 --- a/Rpc/Client.php +++ b/Rpc/Client.php @@ -6,7 +6,7 @@ namespace Rpc; use Exception; use Snowflake\Abstracts\Component; -use Snowflake\Abstracts\Config; +use Swoole; use Snowflake\Core\Json; use Snowflake\Exception\ConfigException; use Swoole\Coroutine\Client as CClient; @@ -52,7 +52,9 @@ class Client extends Component if ($isSend === false) { return $this->addError($this->client->errMsg . '(' . $this->client->errCode . ')'); } - + Swoole\Coroutine\defer(function () { + $this->client->close(); + }); if (is_bool($unpack = Json::decode($this->client->recv()))) { return $this->addError('Service return data format error(500)'); }