From 16450c57b518d03526c0e810a95c36831704b03c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E6=89=87=E6=BB=91=E7=BF=94=E7=BF=BC?= Date: Mon, 30 Jun 2025 18:09:58 +0000 Subject: [PATCH] Reduce meaningless goroutines --- transport/internet/tls/ech.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/transport/internet/tls/ech.go b/transport/internet/tls/ech.go index 8327f359..dedf9d05 100644 --- a/transport/internet/tls/ech.go +++ b/transport/internet/tls/ech.go @@ -133,7 +133,10 @@ func QueryRecord(domain string, server string) ([]byte, error) { if echConfigCache.expire == nil { return echConfigCache.update(domain, server) } else { - go echConfigCache.update(domain, server) + // If someone already acquired the lock, it means it is updating, do not start another update goroutine + if echConfigCache.updateLock.TryLock() { + go echConfigCache.update(domain, server) + } return *echConfigCache.echConfig.Load(), nil } }