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"
|
"hash/fnv"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -363,6 +364,11 @@ func (n *network) resolveNodes() ([]string, error) {
|
|||||||
log.Debugf("Network failed to resolve nodes: %v", err)
|
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
|
// keep processing
|
||||||
|
|
||||||
nodeMap := make(map[string]bool)
|
nodeMap := make(map[string]bool)
|
||||||
|
Loading…
Reference in New Issue
Block a user