mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 08:35:21 +00:00
Fix the channel to fail after the timeout and tries
This commit is contained in:
parent
6c66ae536d
commit
874c0f6eec
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user