You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/08/12 01:56:26 UTC

[GitHub] [inlong] woofyzhao commented on a diff in pull request #5477: [INLONG-5476][Manager] Fix heartbeat status and node list query problem

woofyzhao commented on code in PR #5477:
URL: https://github.com/apache/inlong/pull/5477#discussion_r944059746


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/heartbeat/HeartbeatManager.java:
##########
@@ -66,16 +68,18 @@ public class HeartbeatManager implements AbstractHeartbeatManager {
     @PostConstruct
     public void init() {
         long expireTime = heartbeatInterval() * 2L;
+        Scheduler evictScheduler = Scheduler.forScheduledExecutorService(Executors.newSingleThreadScheduledExecutor());
         heartbeatCache = Caffeine.newBuilder()
+                .scheduler(evictScheduler)
                 .expireAfterAccess(expireTime, TimeUnit.SECONDS)
                 .removalListener((ComponentHeartbeat k, HeartbeatMsg msg, RemovalCause c) -> {
-                    if (msg != null) {
+                    if ((c.wasEvicted() || c == RemovalCause.EXPLICIT) && msg != null) {
                         evictClusterNode(msg);
                     }
                 }).build();
 
         clusterInfoCache = Caffeine.newBuilder()
-                .expireAfterAccess(expireTime, TimeUnit.SECONDS)
+                .expireAfterAccess(expireTime * 2L, TimeUnit.SECONDS)

Review Comment:
   Why double again, needs explanation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org