Skip to content

Commit

Permalink
feat(explorer): list only clusters in a network if it has online workers
Browse files Browse the repository at this point in the history
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
  • Loading branch information
mudler committed Aug 8, 2024
1 parent 5eed360 commit 5ee59a8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/explorer/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func (s *DiscoveryServer) retrieveNetworkData(c context.Context, ledger *blockch
continue LEDGER
}

atLeastOneWorker := false
DATA:
for _, v := range data[d] {
nd := &p2p.NodeData{}
Expand All @@ -142,11 +143,14 @@ func (s *DiscoveryServer) retrieveNetworkData(c context.Context, ledger *blockch
}

if nd.IsOnline() {
atLeastOneWorker = true
(&cd).Workers = append(cd.Workers, nd.ID)
}
}

clusters[d] = cd
if atLeastOneWorker {
clusters[d] = cd
}
}
}
}
Expand Down

0 comments on commit 5ee59a8

Please sign in to comment.