mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-19 04:16:21 +00:00
refactor: lift some code out of inner loop
This commit is contained in:
@@ -39,6 +39,10 @@ func Parents(r report.Report, n report.Node) []Parent {
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
apiTopologyID, ok := primaryAPITopology[topologyID]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
parents, _ := n.Parents.Lookup(topologyID)
|
||||
for _, id := range parents {
|
||||
if topologyID == n.Topology && id == n.ID {
|
||||
@@ -48,10 +52,6 @@ func Parents(r report.Report, n report.Node) []Parent {
|
||||
if !ok {
|
||||
parentNode = report.MakeNode(id).WithTopology(topologyID)
|
||||
}
|
||||
apiTopologyID, ok := primaryAPITopology[topologyID]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if summary, ok := MakeBasicNodeSummary(r, parentNode); ok {
|
||||
result = append(result, Parent{
|
||||
ID: summary.ID,
|
||||
|
||||
Reference in New Issue
Block a user