Chore: load balance hash need to have fallback strategy

This commit is contained in:
Dreamacro
2022-07-04 21:36:33 +08:00
committed by MetaCubeX
parent 7d84a47683
commit 133bb2319f
3 changed files with 3 additions and 7 deletions

View File

@ -29,10 +29,8 @@ type LoadBalance struct {
var errStrategy = errors.New("unsupported strategy")
func parseStrategy(config map[string]any) string {
if elm, ok := config["strategy"]; ok {
if strategy, ok := elm.(string); ok {
return strategy
}
if strategy, ok := config["strategy"].(string); ok {
return strategy
}
return "consistent-hashing"
}