diff --git a/network/default.go b/network/default.go index 914653ec..dfc73bd2 100644 --- a/network/default.go +++ b/network/default.go @@ -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)