From 75b5e664100f070098956c5c50df9d27c8f5b13d Mon Sep 17 00:00:00 2001 From: Yeauty Date: Thu, 17 Oct 2019 17:26:17 +0800 Subject: [PATCH] support reload interval --- src/main/java/org/yeauty/service/impl/MonitorServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/yeauty/service/impl/MonitorServiceImpl.java b/src/main/java/org/yeauty/service/impl/MonitorServiceImpl.java index 7668e9f..a175176 100644 --- a/src/main/java/org/yeauty/service/impl/MonitorServiceImpl.java +++ b/src/main/java/org/yeauty/service/impl/MonitorServiceImpl.java @@ -105,7 +105,7 @@ public void updateNginxFromNacos(File configFile) throws IOException, Interrupte logger.warn("incorrect parameter :{} ", RELOAD_INTERVAL); } while (true) { - if (lastReloadTime.get() == 0L || System.currentTimeMillis() - lastReloadTime.get() < interval) { + if (lastReloadTime.get() == 0L || (System.currentTimeMillis() - lastReloadTime.get()) < interval) { try { TimeUnit.MILLISECONDS.sleep(interval); continue; @@ -128,6 +128,7 @@ public void updateNginxFromNacos(File configFile) throws IOException, Interrupte logger.error("nginx reload incorrect , execute [{}] to get detail ", (cmd + " -s reload")); return; } + lastReloadTime.set(0L); logger.info("nginx reload success!"); } catch (Exception e) { logger.error("reload nginx throw exception", e);