projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '14196-api-v2-tokens' refs #14196
[arvados.git]
/
sdk
/
go
/
keepclient
/
discover.go
diff --git
a/sdk/go/keepclient/discover.go
b/sdk/go/keepclient/discover.go
index c5413d4a4b067c041141b89109afd81a144ed2a6..4377c1951528c4eab88a3525934669c9457f954c 100644
(file)
--- a/
sdk/go/keepclient/discover.go
+++ b/
sdk/go/keepclient/discover.go
@@
-1,3
+1,7
@@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: Apache-2.0
+
package keepclient
import (
package keepclient
import (
@@
-15,17
+19,23
@@
import (
)
// ClearCache clears the Keep service discovery cache.
)
// ClearCache clears the Keep service discovery cache.
-func
ClearCache
() {
+func
RefreshServiceDiscovery
() {
svcListCacheMtx.Lock()
defer svcListCacheMtx.Unlock()
svcListCacheMtx.Lock()
defer svcListCacheMtx.Unlock()
+ var wg sync.WaitGroup
for _, ent := range svcListCache {
for _, ent := range svcListCache {
- ent.clear <- struct{}{}
+ wg.Add(1)
+ go func() {
+ ent.clear <- struct{}{}
+ wg.Done()
+ }()
}
}
+ wg.Wait()
}
// ClearCacheOnSIGHUP installs a signal handler that calls
// ClearCache when SIGHUP is received.
}
// ClearCacheOnSIGHUP installs a signal handler that calls
// ClearCache when SIGHUP is received.
-func
ClearCache
OnSIGHUP() {
+func
RefreshServiceDiscovery
OnSIGHUP() {
svcListCacheMtx.Lock()
defer svcListCacheMtx.Unlock()
if svcListCacheSignal != nil {
svcListCacheMtx.Lock()
defer svcListCacheMtx.Unlock()
if svcListCacheSignal != nil {
@@
-35,7
+45,7
@@
func ClearCacheOnSIGHUP() {
signal.Notify(svcListCacheSignal, syscall.SIGHUP)
go func() {
for range svcListCacheSignal {
signal.Notify(svcListCacheSignal, syscall.SIGHUP)
go func() {
for range svcListCacheSignal {
-
ClearCache
()
+
RefreshServiceDiscovery
()
}
}()
}
}
}()
}