mirror of https://github.com/XTLS/Xray-core
Reduce meaningless goroutines
parent
442f6b7239
commit
d6f1ec481e
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue