From 753ea439226ef8b1e3fe705c17307a4f7e2b07e9 Mon Sep 17 00:00:00 2001 From: fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Sun, 23 Feb 2025 05:45:33 +0800 Subject: [PATCH] fix(dnscache): fix miss counter --- server/utils/dnsCacheManager.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/utils/dnsCacheManager.ts b/server/utils/dnsCacheManager.ts index 9062a69e..0b16fa12 100644 --- a/server/utils/dnsCacheManager.ts +++ b/server/utils/dnsCacheManager.ts @@ -313,8 +313,8 @@ class DnsCacheManager { // Soft expiration. Will use stale entry while refreshing if (age < this.hardTtlMs) { - cached.hits++; - this.stats.hits++; + cached.misses++; + this.stats.misses++; // Background refresh this.resolveWithTtl(hostname) @@ -353,11 +353,10 @@ class DnsCacheManager { } // Hard expiration to remove stale entry - cached.misses++; + this.stats.misses++; this.cache.delete(hostname); } - this.stats.misses++; try { const result = await this.resolveWithTtl(hostname);