From 760fff0c165aef697c124827517236ccfb0e4dfb Mon Sep 17 00:00:00 2001 From: Bi Zhiming Date: Thu, 23 Apr 2020 11:54:55 +0800 Subject: [PATCH] Fixed the rpc client do not work, when jsonrpc server register the same service to consul with jsonrpc and jsonrpc-http protocol. (#1553) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: daydaygo <1252409767@qq.com> Co-authored-by: 李铭昕 <715557344@qq.com> --- CHANGELOG.md | 1 + src/rpc-client/src/AbstractServiceClient.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3c4b0acf..3bc2f2824 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ## Fixed +- [#1553](https://github.com/hyperf/hyperf/pull/1553) Fixed the rpc client do not work, when jsonrpc server register the same service to consul with jsonrpc and jsonrpc-http protocol. - [#1607](https://github.com/hyperf/hyperf/pull/1607) Fixed bug that the return value of function `go` is not adaptive with `swoole`. # v1.1.26 - 2020-04-16 diff --git a/src/rpc-client/src/AbstractServiceClient.php b/src/rpc-client/src/AbstractServiceClient.php index 0d5b412d5..76cc47368 100644 --- a/src/rpc-client/src/AbstractServiceClient.php +++ b/src/rpc-client/src/AbstractServiceClient.php @@ -230,14 +230,14 @@ abstract class AbstractServiceClient $services = $health->service($this->serviceName)->json(); $nodes = []; foreach ($services as $node) { - $passing = true; + $passing = false; $service = $node['Service'] ?? []; $checks = $node['Checks'] ?? []; foreach ($checks as $check) { $status = $check['Status'] ?? false; - if ($status !== 'passing') { - $passing = false; + if ($status === 'passing' && $this->protocol === $service['Meta']['Protocol']) { + $passing = true; } }