Fix the channel to fail after the timeout and tries

This commit is contained in:
Thomas S Hatch 2014-06-17 16:22:10 -06:00
parent 6c66ae536d
commit 874c0f6eec

View File

@ -93,12 +93,19 @@ class RAETChannel(Channel):
'''
msg = {'route': self.route, 'load': load}
self.stack.transmit(msg, self.stack.uids['yard0'])
tried = 1
start = time.time()
while True:
time.sleep(0.01)
self.stack.serviceAll()
if self.stack.rxMsgs:
for msg in self.stack.rxMsgs:
return msg.get('return', {})
if time.time() - start > timeout:
if tried >= tries:
raise ValueError
self.stack.transmit(msg, self.stack.uids['yard0'])
tried += 1
class ZeroMQChannel(Channel):