From b2f50b3ae3b8156b3065cce43cb7e91f2fab6f52 Mon Sep 17 00:00:00 2001 From: gsd Date: Sat, 21 Sep 2024 01:59:30 +0300 Subject: [PATCH] clusters 3 --- .../java/app/annotations/impl/ClusterMethodAspect.java | 4 ++-- src/main/java/app/services/db/DBService.java | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/app/annotations/impl/ClusterMethodAspect.java b/src/main/java/app/annotations/impl/ClusterMethodAspect.java index 7aaa5e0..2cfc998 100644 --- a/src/main/java/app/annotations/impl/ClusterMethodAspect.java +++ b/src/main/java/app/annotations/impl/ClusterMethodAspect.java @@ -38,7 +38,7 @@ public class ClusterMethodAspect extends BaseUpdater { private final RestTemplate restTemplate; private final String[] clusters; private final Logger logger = LoggerFactory.getLogger(getClass()); - private final Long max_range = 300L; + private final Long max_range = 15L; @Autowired public ClusterMethodAspect(Environment environment) { @@ -101,7 +101,7 @@ public class ClusterMethodAspect extends BaseUpdater { for(int i = 0; i < clusters.length; i++) { int finalI = i; this.logger.info("Create cluster pulse check on {}", clusters[finalI]); - CreateTaskUpdater(() -> checkCluster(clusters[finalI]), 60 * 1000, getClass().getName()); + CreateTaskUpdater(() -> checkCluster(clusters[finalI]), 1000, getClass().getName()); } } diff --git a/src/main/java/app/services/db/DBService.java b/src/main/java/app/services/db/DBService.java index 7fcfeb6..d5a26f0 100644 --- a/src/main/java/app/services/db/DBService.java +++ b/src/main/java/app/services/db/DBService.java @@ -21,9 +21,13 @@ public class DBService { JdbcTemplate jdbcTemplate_ro; public Long getDBServerTime() { - Long rw_time = getMainServerTime(); - Long ro_time = getReplicaServerTime(); - return rw_time; + try { + Long rw_time = getMainServerTime(); + Long ro_time = getReplicaServerTime(); + return rw_time; + } catch (Exception e) { + return 0L; + } } public Long getMainServerTime() {