mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-08-22 09:36:49 +08:00
Reduce meaningless goroutines
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user