fix bug with all zero weights
This commit is contained in:
parent
98dc22aeda
commit
2a025ffa94
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"weights": [0, 0, 0, 2]
|
"weights": [1, 0, 0, 0]
|
||||||
}
|
}
|
||||||
@ -151,6 +151,10 @@ func (pm *ProxyManager) applyWeight() {
|
|||||||
chooseArr = append(chooseArr, wr.Choice{Item: len(pm.enabledIndics) - 1, Weight: uint(p.Weight)})
|
chooseArr = append(chooseArr, wr.Choice{Item: len(pm.enabledIndics) - 1, Weight: uint(p.Weight)})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if len(pm.enabledIndics) == 0 {
|
||||||
|
fmt.Println("no enabled indice, proxy will be disabled.")
|
||||||
|
return
|
||||||
|
}
|
||||||
fmt.Println("enabled indices:", pm.enabledIndics)
|
fmt.Println("enabled indices:", pm.enabledIndics)
|
||||||
pm.Chooser = wr.NewChooser(chooseArr...)
|
pm.Chooser = wr.NewChooser(chooseArr...)
|
||||||
// update cache to remove disabled proxys
|
// update cache to remove disabled proxys
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user