Respect timeout when not accepting requests

So far the timeout was only in effect when any of the requests was
accepted by the launcher. When there are a lot of other requests (e.g.
to be declined) we might exceed the timout in some cases.

Change-Id: Iaed8302c94e12467834fadee25a80198db5e629d
This commit is contained in:
Simon Westphahl 2023-03-09 09:03:42 +01:00
parent 5eb0bc2fce
commit 0b325f8a6b
No known key found for this signature in database
1 changed files with 4 additions and 3 deletions

View File

@ -147,6 +147,10 @@ class PoolWorker(threading.Thread, stats.StatsReporter):
if not self.running:
return True
# if we exceeded the timeout stop iterating here
if time.monotonic() - start > timeout:
return False
req = self.zk.getNodeRequest(req.id)
if not req:
continue
@ -278,9 +282,6 @@ class PoolWorker(threading.Thread, stats.StatsReporter):
self.paused_handlers.add(rh)
self.request_handlers.append(rh)
# if we exceeded the timeout stop iterating here
if time.monotonic() - start > timeout:
return False
return True
def _removeCompletedHandlers(self):