From 005ce64c2d746ecdeedb98cb322f54b929dd4645 Mon Sep 17 00:00:00 2001 From: GatewayJ <835269233@qq.com> Date: Thu, 19 Mar 2026 10:15:08 +0800 Subject: [PATCH] config: refresh Nacos listener MD5 on change before repolling Made-with: Cursor --- src/config/sources/nacos-client.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/config/sources/nacos-client.ts b/src/config/sources/nacos-client.ts index eccbb6d3963..d4ea049c983 100644 --- a/src/config/sources/nacos-client.ts +++ b/src/config/sources/nacos-client.ts @@ -82,7 +82,18 @@ export function createNacosConfigClient(opts: NacosConfigClientOptions): NacosCo if (stopped) return; if (res.ok) { const text = await res.text(); - if (text.trim()) onChange(); + if (text.trim()) { + try { + const getRes = await doFetch(getConfigUrl()); + if (getRes.ok) { + const content = await getRes.text(); + lastContentMD5 = crypto.createHash("md5").update(content).digest("hex"); + } + } catch { + // Keep stale MD5; next poll may get same change again + } + onChange(); + } } } catch { await new Promise((r) => setTimeout(r, 5000));