diff --git a/lib/exaproxy/reactor/redirector/manager.py b/lib/exaproxy/reactor/redirector/manager.py index 7c87e33..e7b5b63 100644 --- a/lib/exaproxy/reactor/redirector/manager.py +++ b/lib/exaproxy/reactor/redirector/manager.py @@ -200,7 +200,10 @@ def acquire (self): return worker def release (self, wid): - if wid not in self.stopping and wid in self.worker: + if wid not in self.worker: + return + + if wid not in self.stopping: self.available.add(wid) else: diff --git a/lib/exaproxy/reactor/redirector/reactor.py b/lib/exaproxy/reactor/redirector/reactor.py index 33ecf12..ca89227 100644 --- a/lib/exaproxy/reactor/redirector/reactor.py +++ b/lib/exaproxy/reactor/redirector/reactor.py @@ -32,7 +32,7 @@ def run(self): # we may have new workers to deal with queued requests client_id, command, decision = self.decider.doqueue() - while client_id is not None: + while command is not None: self.querier.sendResponse(client_id, command, decision) client_id, command, decision = self.decider.doqueue() @@ -62,7 +62,7 @@ def run(self): # decisions made by the child processes for worker in events.get('read_workers', []): client_id, command, decision = self.decider.getDecision(worker) - if client_id is not None: + if command is not None: self.querier.sendResponse(client_id, command, decision) # we should have available workers now so check for queued requests diff --git a/lib/exaproxy/supervisor.py b/lib/exaproxy/supervisor.py index 9ff84ff..28b0e0d 100644 --- a/lib/exaproxy/supervisor.py +++ b/lib/exaproxy/supervisor.py @@ -245,7 +245,7 @@ def run (self): # check for IO change with select status = self.reactor.run() if status is False: - self.exit() + self._shutdown = True # must follow the reactor so we are sure to go through the reactor at least once # and flush any logs