Rename LbStrategyFastest to LbStrategyFirst
This commit is contained in:
parent
3f2656dbe3
commit
2e89c8da01
|
@ -309,7 +309,8 @@ func ConfigLoad(proxy *Proxy, svcFlag *string) error {
|
||||||
case "ph":
|
case "ph":
|
||||||
lbStrategy = LBStrategyPH
|
lbStrategy = LBStrategyPH
|
||||||
case "fastest":
|
case "fastest":
|
||||||
lbStrategy = LBStrategyFastest
|
case "first":
|
||||||
|
lbStrategy = LBStrategyFirst
|
||||||
case "random":
|
case "random":
|
||||||
lbStrategy = LBStrategyRandom
|
lbStrategy = LBStrategyRandom
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -118,7 +118,7 @@ keepalive = 30
|
||||||
refused_code_in_responses = false
|
refused_code_in_responses = false
|
||||||
|
|
||||||
|
|
||||||
## Load-balancing strategy: 'p2' (default), 'ph', 'fastest' or 'random'
|
## Load-balancing strategy: 'p2' (default), 'ph', 'first' or 'random'
|
||||||
|
|
||||||
# lb_strategy = 'p2'
|
# lb_strategy = 'p2'
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ const (
|
||||||
LBStrategyNone = LBStrategy(iota)
|
LBStrategyNone = LBStrategy(iota)
|
||||||
LBStrategyP2
|
LBStrategyP2
|
||||||
LBStrategyPH
|
LBStrategyPH
|
||||||
LBStrategyFastest
|
LBStrategyFirst
|
||||||
LBStrategyRandom
|
LBStrategyRandom
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ func (serversInfo *ServersInfo) getOne() *ServerInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch serversInfo.lbStrategy {
|
switch serversInfo.lbStrategy {
|
||||||
case LBStrategyFastest:
|
case LBStrategyFirst:
|
||||||
candidate = 0
|
candidate = 0
|
||||||
case LBStrategyPH:
|
case LBStrategyPH:
|
||||||
candidate = rand.Intn(Min(Min(serversCount, 2), serversCount/2))
|
candidate = rand.Intn(Min(Min(serversCount, 2), serversCount/2))
|
||||||
|
|
Loading…
Reference in New Issue