1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

fix nacos heart beat unit, second to millisecond.

This commit is contained in:
horizonzy 2020-12-21 22:06:17 +08:00
parent 625b44e185
commit 0e38870735

View File

@ -19,6 +19,7 @@ package com.alibaba.cloud.nacos.registry;
import java.net.URI; import java.net.URI;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@ -99,15 +100,15 @@ public class NacosRegistration implements Registration, ServiceInstance {
if (null != nacosDiscoveryProperties.getHeartBeatInterval()) { if (null != nacosDiscoveryProperties.getHeartBeatInterval()) {
metadata.put(PreservedMetadataKeys.HEART_BEAT_INTERVAL, metadata.put(PreservedMetadataKeys.HEART_BEAT_INTERVAL,
nacosDiscoveryProperties.getHeartBeatInterval().toString()); String.valueOf(TimeUnit.SECONDS.toMillis(nacosDiscoveryProperties.getHeartBeatInterval())));
} }
if (null != nacosDiscoveryProperties.getHeartBeatTimeout()) { if (null != nacosDiscoveryProperties.getHeartBeatTimeout()) {
metadata.put(PreservedMetadataKeys.HEART_BEAT_TIMEOUT, metadata.put(PreservedMetadataKeys.HEART_BEAT_TIMEOUT,
nacosDiscoveryProperties.getHeartBeatTimeout().toString()); String.valueOf(TimeUnit.SECONDS.toMillis(nacosDiscoveryProperties.getHeartBeatTimeout())));
} }
if (null != nacosDiscoveryProperties.getIpDeleteTimeout()) { if (null != nacosDiscoveryProperties.getIpDeleteTimeout()) {
metadata.put(PreservedMetadataKeys.IP_DELETE_TIMEOUT, metadata.put(PreservedMetadataKeys.IP_DELETE_TIMEOUT,
nacosDiscoveryProperties.getIpDeleteTimeout().toString()); String.valueOf(TimeUnit.SECONDS.toMillis(nacosDiscoveryProperties.getIpDeleteTimeout())));
} }
customize(registrationCustomizers, this); customize(registrationCustomizers, this);
} }