Merge branch '14196-api-v2-tokens' refs #14196
[arvados.git] / sdk / go / keepclient / discover.go
index e2cd329fc4c22ccfdb73ff6099ce8c95f6f28d16..4377c1951528c4eab88a3525934669c9457f954c 100644 (file)
@@ -1,3 +1,7 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: Apache-2.0
+
 package keepclient
 
 import (
@@ -18,9 +22,15 @@ import (
 func RefreshServiceDiscovery() {
        svcListCacheMtx.Lock()
        defer svcListCacheMtx.Unlock()
+       var wg sync.WaitGroup
        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