mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-06-03 06:07:20 +02:00
📝 discribe for upstream sort func
This commit is contained in:
parent
6bfcb2e1f5
commit
0dddd1f9e3
@ -36,15 +36,19 @@ func ReverseProxyUpstreamList(w http.ResponseWriter, r *http.Request) {
|
||||
inactiveUpstreams := targetEndpoint.InactiveOrigins
|
||||
slices.SortFunc(activeUpstreams, func(i, j *loadbalance.Upstream) int {
|
||||
if i.Weight != j.Weight {
|
||||
// sort by weight DESC
|
||||
return cmp.Compare(j.Weight, i.Weight)
|
||||
}
|
||||
// sort by origin ASC
|
||||
return cmp.Compare(i.OriginIpOrDomain, j.OriginIpOrDomain)
|
||||
})
|
||||
|
||||
slices.SortFunc(inactiveUpstreams, func(i, j *loadbalance.Upstream) int {
|
||||
if i.Weight != j.Weight {
|
||||
// sort by weight DESC
|
||||
return cmp.Compare(j.Weight, i.Weight)
|
||||
}
|
||||
// sort by origin ASC
|
||||
return cmp.Compare(i.OriginIpOrDomain, j.OriginIpOrDomain)
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user