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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]