Release worker_semaphore when failing to create worker

exposed when playing around with arbitrary Tasks in a shell; this created
workers I could not run, which would put the foreman in a 'waiting for available threads'
mode.

I briefly looked at the rest of that loop to see whether more exception handling
is necessary, but TBH I don't think we can reasonably recover from e.g. task.delete()
failing (or at least I don't want to think about it now)
This commit is contained in:
Klaas van Schelven
2024-07-05 15:58:15 +02:00
parent 259069f6e2
commit 1eb65a7790

View File

@@ -296,6 +296,7 @@ class Foreman:
with time_to_logger(performance_logger, "Snappea delete Task"):
task.delete() # we delete the task because we can't do anything with it, and we don't want to hang
capture_exception(e)
self.worker_semaphore.release()
continue
self.check_for_stopping() # check_for_stopping() right before taking on the work