Skip to content

Commit

Permalink
Merge pull request #21 from david-farrar/master
Browse files Browse the repository at this point in the history
don't reap what isn't there
shutdown properly when the reactor signals an error
fix sending responses when we do not yet have the answer
  • Loading branch information
thomas-mangin committed Aug 11, 2014
2 parents 94b2173 + d2fe184 commit b79ac90
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/exaproxy/reactor/redirector/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions lib/exaproxy/reactor/redirector/reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/exaproxy/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b79ac90

Please sign in to comment.