mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix the channel to fail after the timeout and tries
This commit is contained in:
parent
6c66ae536d
commit
874c0f6eec
1 changed files with 7 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue