mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-07-05 01:24:15 +00:00
Reduce meaningless goroutines
This commit is contained in:
parent
8b8bd3c40d
commit
16450c57b5
1 changed files with 4 additions and 1 deletions
|
@ -133,7 +133,10 @@ func QueryRecord(domain string, server string) ([]byte, error) {
|
|||
if echConfigCache.expire == nil {
|
||||
return echConfigCache.update(domain, server)
|
||||
} else {
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue