Chore: load balance hash need to have fallback strategy

This commit is contained in:
Dreamacro 2022-07-04 21:36:33 +08:00
parent 77a1e3a653
commit 557297ac9a
1 changed files with 7 additions and 0 deletions

View File

@ -127,6 +127,13 @@ func strategyConsistentHashing() strategyFn {
}
}
// when availability is poor, traverse the entire list to get the available nodes
for _, proxy := range proxies {
if proxy.Alive() {
return proxy
}
}
return proxies[0]
}
}