节点配置中对父级节点进行排序,以保证查找的稳定性

This commit is contained in:
GoEdgeLab
2023-09-22 11:55:47 +08:00
parent d5c2b7f7d2
commit 3146463771

View File

@@ -26,6 +26,7 @@ import (
"github.com/iwind/TeaGo/rands"
"github.com/iwind/TeaGo/types"
timeutil "github.com/iwind/TeaGo/utils/time"
"sort"
"strconv"
"strings"
"time"
@@ -2103,6 +2104,12 @@ func (this *NodeDAO) FindParentNodeConfigs(tx *dbs.Tx, nodeId int64, groupId int
Addrs: addrStrings,
SecretHash: secretHash,
})
// 排序
sort.Slice(parentNodeConfigs, func(i, j int) bool {
return parentNodeConfigs[i].Id < parentNodeConfigs[j].Id
})
result[clusterId] = parentNodeConfigs
}
}