Update AbstractServiceClient.php

This commit is contained in:
黄朝晖 2019-11-07 11:39:31 +08:00 committed by GitHub
parent 04160bb07f
commit c3bad4c68d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -203,9 +203,10 @@ abstract class AbstractServiceClient
$passing = true;
$service = $node['Service'] ?? [];
$checks = $node['Checks'] ?? [];
foreach ($checks as $check) {
$status = $check['Status'] ?? false;
if ($status != 'passing') {
if ($status !== 'passing') {
$passing = false;
}
}
@ -213,7 +214,7 @@ abstract class AbstractServiceClient
if ($passing) {
$address = $service['Address'] ?? '';
$port = (int)$service['Port'] ?? 0;
$nodes[] = new Node($address, $port);
$address && $port && $nodes[] = new Node($address, $port);
}
}
return $nodes;