Fix idle runner being memory leaked

when its allocation is restarted by Nomad.

Fix logic created in 354c16cc.
This commit is contained in:
Maximilian Paß
2024-05-30 12:14:20 +02:00
parent 1ddccb308a
commit cbcd5f233e
7 changed files with 102 additions and 30 deletions

View File

@ -116,6 +116,6 @@ func (a *AWSEnvironment) AddRunner(_ runner.Runner) {
panic("not supported")
}
func (a *AWSEnvironment) DeleteRunner(_ string) (ok bool) {
func (a *AWSEnvironment) DeleteRunner(_ string) (r runner.Runner, ok bool) {
panic("not supported")
}

View File

@ -271,10 +271,10 @@ func (n *NomadEnvironment) AddRunner(r runner.Runner) {
n.idleRunners.Add(r.ID(), r)
}
func (n *NomadEnvironment) DeleteRunner(id string) (ok bool) {
_, ok = n.idleRunners.Get(id)
func (n *NomadEnvironment) DeleteRunner(id string) (r runner.Runner, ok bool) {
r, ok = n.idleRunners.Get(id)
n.idleRunners.Delete(id)
return ok
return r, ok
}
func (n *NomadEnvironment) IdleRunnerCount() uint {