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

@ -46,9 +46,10 @@ type ExecutionEnvironment interface {
Sample() (r Runner, ok bool)
// AddRunner adds an existing runner to the idle runners of the environment.
AddRunner(r Runner)
// DeleteRunner removes an idle runner from the environment.
// DeleteRunner removes an idle runner from the environment and returns it.
// This function handles only the environment. The runner has to be destroyed separately.
// ok is true iff the runner was found (and deleted).
DeleteRunner(id string) (ok bool)
DeleteRunner(id string) (r Runner, ok bool)
// IdleRunnerCount returns the number of idle runners of the environment.
IdleRunnerCount() uint
}