Commit d0775e40 authored by Aurel's avatar Aurel

remove busy loop


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@176 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent d7a5b14b
...@@ -49,15 +49,13 @@ class Dispatcher(Thread): ...@@ -49,15 +49,13 @@ class Dispatcher(Thread):
if app.pt is not None: if app.pt is not None:
app.pt.clear() app.pt.clear()
master_index = 0 master_index = 0
t = 0
conn = None conn = None
# Make application execute remaining message if any # Make application execute remaining message if any
app._waitMessage() app._waitMessage()
# Wait a bit before trying to reconnect
t = time()
while time() < t + 1:
pass
handler = ClientEventHandler(app, app.dispatcher) handler = ClientEventHandler(app, app.dispatcher)
while 1: while 1:
if t + 1 < time():
if app.pt is not None and app.pt.operational(): if app.pt is not None and app.pt.operational():
# Connected to primary master node and got all informations # Connected to primary master node and got all informations
break break
...@@ -93,9 +91,6 @@ class Dispatcher(Thread): ...@@ -93,9 +91,6 @@ class Dispatcher(Thread):
try: try:
self.em.poll(1) self.em.poll(1)
except TypeError: except TypeError:
t = time()
while time() < t + 1:
pass
break break
app._waitMessage() app._waitMessage()
# Now check result # Now check result
...@@ -110,13 +105,11 @@ class Dispatcher(Thread): ...@@ -110,13 +105,11 @@ class Dispatcher(Thread):
break break
elif app.node_not_ready: elif app.node_not_ready:
# Wait a bit and reask again # Wait a bit and reask again
t = time()
while time() < t + 1:
pass
break break
elif app.pt is not None and app.pt.operational(): elif app.pt is not None and app.pt.operational():
# Connected to primary master node # Connected to primary master node
break break
t = time()
logging.info("connected to primary master node %s:%d" %app.primary_master_node.getServer()) logging.info("connected to primary master node %s:%d" %app.primary_master_node.getServer())
app.master_conn = conn app.master_conn = conn
......
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