satellite/satellitedb: update nodes in sorted order (#3446)

This commit is contained in:
Egon Elbre 2019-11-01 19:07:23 +02:00 committed by Stefan Benten
parent e0ef01d7a3
commit aa761700af

View File

@ -530,6 +530,11 @@ func (cache *overlaycache) BatchUpdateStats(ctx context.Context, updateRequests
return failed, nil return failed, nil
} }
// ensure updates happen in-order
sort.Slice(updateRequests, func(i, k int) bool {
return updateRequests[i].NodeID.Less(updateRequests[k].NodeID)
})
doUpdate := func(updateSlice []*overlay.UpdateRequest) (duf storj.NodeIDList, err error) { doUpdate := func(updateSlice []*overlay.UpdateRequest) (duf storj.NodeIDList, err error) {
appendAll := func() { appendAll := func() {
for _, ur := range updateRequests { for _, ur := range updateRequests {