Chore: cleanup code
This commit is contained in:
parent
192ae06fe5
commit
2a01a0b583
2 changed files with 4 additions and 8 deletions
|
@ -30,11 +30,9 @@ type LoadBalance struct {
|
||||||
var errStrategy = errors.New("unsupported strategy")
|
var errStrategy = errors.New("unsupported strategy")
|
||||||
|
|
||||||
func parseStrategy(config map[string]any) string {
|
func parseStrategy(config map[string]any) string {
|
||||||
if elm, ok := config["strategy"]; ok {
|
if strategy, ok := config["strategy"].(string); ok {
|
||||||
if strategy, ok := elm.(string); ok {
|
|
||||||
return strategy
|
return strategy
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return "consistent-hashing"
|
return "consistent-hashing"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,11 +125,9 @@ func parseURLTestOption(config map[string]any) []urlTestOption {
|
||||||
opts := []urlTestOption{}
|
opts := []urlTestOption{}
|
||||||
|
|
||||||
// tolerance
|
// tolerance
|
||||||
if elm, ok := config["tolerance"]; ok {
|
if tolerance, ok := config["tolerance"].(int); ok {
|
||||||
if tolerance, ok := elm.(int); ok {
|
|
||||||
opts = append(opts, urlTestWithTolerance(uint16(tolerance)))
|
opts = append(opts, urlTestWithTolerance(uint16(tolerance)))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return opts
|
return opts
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue