mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fix index bug the _right_ way
This commit is contained in:
@@ -49,10 +49,14 @@ func (p *chPlacer) PlaceCall(ctx context.Context, rp RunnerPool, call RunnerCall
|
||||
var runnerPoolErr error
|
||||
for {
|
||||
var runners []Runner
|
||||
for j := 0; len(runners) > 0 && !state.IsDone(); j++ {
|
||||
for j := 0; !state.IsDone(); j++ {
|
||||
// refresh each iteration (should be cached...). detect if runner list changed, and reset j if so (?)
|
||||
oldRunners := runners
|
||||
runners, runnerPoolErr = rp.Runners(ctx, call)
|
||||
if len(runners) == 0 {
|
||||
j = -1 // TODO make j cleaner, this just fixes j to 0 if runners errors
|
||||
break
|
||||
}
|
||||
if !equal(runners, oldRunners) {
|
||||
j = 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user