refactor: strategyStickySessions
This commit is contained in:
parent
0eecb03bfa
commit
375ed774be
1 changed files with 2 additions and 5 deletions
|
@ -173,7 +173,7 @@ func strategyStickySessions() strategyFn {
|
||||||
}
|
}
|
||||||
session.time = now
|
session.time = now
|
||||||
|
|
||||||
var i int
|
session.idx = 0
|
||||||
var res = proxies[0]
|
var res = proxies[0]
|
||||||
for i := 0; i < length; i++ {
|
for i := 0; i < length; i++ {
|
||||||
idx := (session.idx + i) % length
|
idx := (session.idx + i) % length
|
||||||
|
@ -184,10 +184,7 @@ func strategyStickySessions() strategyFn {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if i == length {
|
|
||||||
session.idx = 0
|
|
||||||
res = proxies[0]
|
|
||||||
}
|
|
||||||
Sessions[src][dest] = session
|
Sessions[src][dest] = session
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue