Update list-nodes and list-storages
@@ -275,8 +275,6 @@ func (s *MessagesServer) Clients() map[string]Client {
func (s *MessagesServer) ClientsByReplicaset() map[string][]Client {
replicas := make(map[string][]Client)
- s.clientsLock.Lock()
-
for _, client := range s.clients {
if client.ReplicasetName == "" { // mongos?
continue
@@ -288,7 +286,6 @@ func (s *MessagesServer) ClientsByReplicaset() map[string][]Client {
}
- s.clientsLock.Unlock()
return replicas
}
@@ -297,7 +294,6 @@ func (s *MessagesServer) LastOplogTs() int64 {
}
func (s *MessagesServer) ListStorages() (map[string]StorageEntry, error) {
-
return s.listStorages()
}
@@ -312,37 +308,16 @@ func (s *MessagesServer) listStorages() (map[string]StorageEntry, error) {
}
var errs error
- wga := &sync.WaitGroup{}
- wgb := sync.WaitGroup{}
- ch := make(chan resp)
-
- wga.Add(1)
- go func() {
- for r := range ch {
- stgs[r.id] = r.ssInfo
- }
- wga.Done()
- }()
-
- s.clientsLock.Lock()
for lid, lc := range s.clients {
id := lid
c := lc
- wgb.Add(1)
- go func() {
- defer wgb.Done()
ssInfo, err := c.GetStoragesInfo()
if err != nil {
errs = multierror.Append(errs, err)
- return
+ return nil, errs
}
- ch <- resp{id: id, ssInfo: ssInfo}
- }()
+ stgs[id] = ssInfo
}
- s.clientsLock.Unlock()
- wgb.Wait()
- close(ch)
- wga.Wait()
if errs != nil {
return nil, errs
