From 277cbaa9130cf8e364742ecf97e6fa1d4d5e398c Mon Sep 17 00:00:00 2001 From: tanghc Date: Fri, 9 Aug 2019 19:25:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3=E5=88=B7=E6=96=B0=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitee/sop/websiteserver/manager/DocManagerImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/DocManagerImpl.java b/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/DocManagerImpl.java index 11e8bb04..ae030608 100644 --- a/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/DocManagerImpl.java +++ b/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/DocManagerImpl.java @@ -11,8 +11,10 @@ import com.gitee.sop.websiteserver.bean.DocItem; import com.gitee.sop.websiteserver.bean.ZookeeperContext; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.math.NumberUtils; import org.apache.curator.framework.recipes.cache.TreeCacheEvent; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -65,6 +67,9 @@ public class DocManagerImpl implements DocManager { @Autowired private RegistryService registryService; + @Value("${doc.refresh-seconds:60}") + private String refreshSeconds; + private volatile boolean listenInited; @Override @@ -169,7 +174,7 @@ public class DocManagerImpl implements DocManager { ZKServiceInfo serviceInfo = JSON.parseObject(serviceInfoJson, ZKServiceInfo.class); String serviceId = serviceInfo.getServiceId(); log.info("微服务[{}]推送更新", serviceId); - Msg msg = new Msg(id, 1000 * 20); + Msg msg = new Msg(id, 1000 * NumberUtils.toInt(refreshSeconds, 60)); msg.serviceId = serviceId; // 延迟20秒执行 queue.offer(msg);