projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
12746: Log host cgroup stats to hoststat.txt.
[arvados.git]
/
services
/
keep-balance
/
balance.go
diff --git
a/services/keep-balance/balance.go
b/services/keep-balance/balance.go
index 25b474b9ca0a475f81cc08db02ef007e9fe009f0..0c4dd5ba4cd16c38de2ebdf729b16af7a3a5ec64 100644
(file)
--- a/
services/keep-balance/balance.go
+++ b/
services/keep-balance/balance.go
@@
-1,3
+1,7
@@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
package main
import (
package main
import (
@@
-244,6
+248,12
@@
func (bal *Balancer) GetCurrentState(c *arvados.Client, pageSize, bufs int) erro
errs <- fmt.Errorf("%s: %v", srv, err)
return
}
errs <- fmt.Errorf("%s: %v", srv, err)
return
}
+ if len(errs) > 0 {
+ // Some other goroutine encountered an
+ // error -- any further effort here
+ // will be wasted.
+ return
+ }
bal.logf("%s: add %d replicas to map", srv, len(idx))
bal.BlockStateMap.AddReplicas(srv, idx)
bal.logf("%s: done", srv)
bal.logf("%s: add %d replicas to map", srv, len(idx))
bal.BlockStateMap.AddReplicas(srv, idx)
bal.logf("%s: done", srv)
@@
-298,14
+308,11
@@
func (bal *Balancer) GetCurrentState(c *arvados.Client, pageSize, bufs int) erro
}
}()
}
}()
- go func() {
- // Send a nil error when all goroutines finish. If
- // this is the first error sent to errs, then
- // everything worked.
- wg.Wait()
- errs <- nil
- }()
- return <-errs
+ wg.Wait()
+ if len(errs) > 0 {
+ return <-errs
+ }
+ return nil
}
func (bal *Balancer) addCollection(coll arvados.Collection) error {
}
func (bal *Balancer) addCollection(coll arvados.Collection) error {