Fixed bug that heartbeat failed when using nacos without default group. (#3873)

* fixed 修复nacos原生用法心跳异常

* fixed 修复ephemeral 是否临时实例设置不生效问题

Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
zxyfaxcn 2021-07-30 18:32:38 +08:00 committed by GitHub
parent 91aae7df4f
commit 2132ee5ebe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -2,7 +2,7 @@
## Fixed
- [#3872](https://github.com/hyperf/hyperf/pull/3872) Fixed bug that heartbeat failed when using nacos without default group.
- [#3872](https://github.com/hyperf/hyperf/pull/3872) [#3873](https://github.com/hyperf/hyperf/pull/3873) Fixed bug that heartbeat failed when using nacos without default group.
- [#3879](https://github.com/hyperf/hyperf/pull/3879) Fixed bug that `watcher` does not work caused by proxies replaced.
# v2.2.1 - 2021-07-27

View File

@ -105,7 +105,7 @@ class MainWorkerStartListener implements ListenerInterface
// Register Instance to Nacos.
$instanceConfig = $serviceConfig['instance'] ?? [];
$ephemeral = $instanceConfig['ephemeral'] ?? null;
$ephemeral = in_array($instanceConfig['ephemeral'], [true, 'true'], true) ? 'true' : 'false';
$cluster = $instanceConfig['cluster'] ?? null;
$weight = $instanceConfig['weight'] ?? null;
$metadata = $instanceConfig['metadata'] ?? null;

View File

@ -33,6 +33,7 @@ class InstanceBeatProcess extends AbstractProcess
$serviceConfig = $config->get('nacos.service', []);
$serviceName = $serviceConfig['service_name'];
$namespaceId = $serviceConfig['namespace_id'];
$groupName = $serviceConfig['group_name'] ?? null;
$instanceConfig = $serviceConfig['instance'] ?? [];
$ephemeral = $instanceConfig['ephemeral'] ?? null;
@ -53,10 +54,12 @@ class InstanceBeatProcess extends AbstractProcess
[
'ip' => $ip,
'port' => $port,
'serviceName' => $groupName . '@@' . $serviceName,
'cluster' => $cluster,
'weight' => $weight,
],
$groupName,
$namespaceId,
$ephemeral
);