From 8037078903173617acf1cc72e23e13334f663717 Mon Sep 17 00:00:00 2001 From: abu007 <995230548@qq.com> Date: Thu, 24 Oct 2024 21:56:34 +0800 Subject: [PATCH] [collector]bugfix: colse connection when common cache is timeout --- .../collector/collect/common/cache/ConnectionCommonCache.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/collector/collector-common/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java b/collector/collector-common/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java index d36941d9fee..8e2f603bf03 100644 --- a/collector/collector-common/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java +++ b/collector/collector-common/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java @@ -147,8 +147,7 @@ public Optional getCache(T key, boolean refreshCache) { } if (cacheTime[0] + cacheTime[1] < System.currentTimeMillis()) { log.warn("[connection common cache] is timeout, remove it, key {}.", key); - timeoutMap.remove(key); - cacheMap.remove(key); + removeCache(key); return Optional.empty(); } C value = cacheMap.compute(key, (k, v) -> {