Commit 9b259cdb authored by Vincent Pelletier's avatar Vincent Pelletier

Use time.sleep instead of a busy loop to wait for one second to pass.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@313 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent b8ee52f6
......@@ -22,7 +22,7 @@ from neo.protocol import PING, Packet, CLIENT_NODE_TYPE, FINISH_TRANSACTION
from neo.connection import MTClientConnection
from neo.node import MasterNode
from time import time
import time
import logging
class Dispatcher(Thread):
......@@ -76,13 +76,11 @@ class Dispatcher(Thread):
if app.pt is not None:
app.pt.clear()
master_index = 0
t = 0
conn = None
# Make application execute remaining message if any
app._waitMessage()
handler = ClientEventHandler(app, app.dispatcher)
while 1:
if t + 1 < time():
if app.pt is not None and app.pt.operational():
# Connected to primary master node and got all informations
break
......@@ -140,7 +138,7 @@ class Dispatcher(Thread):
elif app.pt is not None and app.pt.operational():
# Connected to primary master node
break
t = time()
time.sleep(1)
logging.info("connected to primary master node %s:%d" %app.primary_master_node.getServer())
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