Commit af907e65 authored by Vincent Pelletier's avatar Vincent Pelletier

Simplify loop exit logic.

Also, don't add 10 to "t" on each iteration.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1608 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 6961628f
...@@ -226,15 +226,12 @@ class Application(object): ...@@ -226,15 +226,12 @@ class Application(object):
# Wait until the connections are closed. # Wait until the connections are closed.
self.primary = None self.primary = None
self.primary_master_node = None self.primary_master_node = None
t = time() t = time() + 10
while self.em.getClientList(): while self.em.getClientList() and time() < t:
try: try:
self.em.poll(1) self.em.poll(1)
except ElectionFailure: except ElectionFailure:
pass pass
if time() > t + 10:
# If too long, do not wait.
break
# Close all connections. # Close all connections.
for conn in self.em.getClientList() + self.em.getServerList(): for conn in self.em.getClientList() + self.em.getServerList():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment