From 9f31902379fa9ac5c2b9661e6bc1eb8bad76b514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 29 Mar 2021 18:43:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rpc/Client.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Rpc/Client.php b/Rpc/Client.php index 87eebf52..08a6c9b8 100644 --- a/Rpc/Client.php +++ b/Rpc/Client.php @@ -49,10 +49,12 @@ class Client extends Component return false; } $isSend = $this->client->send(Json::encode(['cmd' => $cmd, 'body' => $param])); - $this->recover(); if ($isSend === false) { return $this->addError($this->client->errMsg . '(' . $this->client->errCode . ')'); } + \Swoole\Coroutine\defer(function () { + $this->recover(); + }); if (is_bool($unpack = Json::decode($this->client->recv()))) { return $this->addError('Service return data format error(500)'); }