Fix decreased prewarming pool due to inactivity timer.

When allocations fail and restart they are added again to the idle runners. The bug fixed with this commit is that the inactivity timer was not stopped at the restart. This led to the idle runner being removed when the timer expired.
This commit is contained in:
Maximilian Paß
2023-06-14 22:27:52 +01:00
parent f031219cb8
commit 527aaf713f
2 changed files with 41 additions and 2 deletions

View File

@ -190,8 +190,11 @@ func (m *NomadRunnerManager) onAllocationStopped(runnerID string) (alreadyRemove
return false
}
_, stillActive := m.usedRunners.Get(runnerID)
m.usedRunners.Delete(runnerID)
r, stillActive := m.usedRunners.Get(runnerID)
if stillActive {
r.StopTimeout()
m.usedRunners.Delete(runnerID)
}
environment, ok := m.environments.Get(environmentID.ToString())
if ok {