[#1528] node: Keep order for equal elements when sort priority metrics

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
Anton Nikiforov 2024-12-02 13:31:32 +03:00
parent e0ac3a583f
commit edfa3f4825

View file

@ -202,7 +202,7 @@ func sortVector(cfg *cfg, unsortedVector []netmap.NodeInfo) ([]netmap.NodeInfo,
metrics: m,
}
}
slices.SortFunc(nm, func(a, b nodeMetrics) int {
slices.SortStableFunc(nm, func(a, b nodeMetrics) int {
return slices.Compare(a.metrics, b.metrics)
})
sortedVector := make([]netmap.NodeInfo, len(unsortedVector))