sort resolved node list in network by lowest priority
This commit is contained in:
parent
8da77a3ddc
commit
e966944ae5
@ -6,6 +6,7 @@ import (
|
||||
"hash/fnv"
|
||||
"io"
|
||||
"math"
|
||||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -363,6 +364,11 @@ func (n *network) resolveNodes() ([]string, error) {
|
||||
log.Debugf("Network failed to resolve nodes: %v", err)
|
||||
}
|
||||
|
||||
// sort by lowest priority
|
||||
if err == nil {
|
||||
sort.Slice(records, func(i, j int) bool { return records[i].Priority < records[j].Priority })
|
||||
}
|
||||
|
||||
// keep processing
|
||||
|
||||
nodeMap := make(map[string]bool)
|
||||
|
Loading…
Reference in New Issue
Block a user