mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fixed syndic event bus connection.
Connect syndic to master event bus in a coroutine. This fixes connection timeout handling and prevents CPU utilization by connect loop if no master is running.
This commit is contained in:
parent
ea8e1385c1
commit
ab1afd002e
1 changed files with 5 additions and 3 deletions
|
@ -687,6 +687,7 @@ class IPCMessageSubscriber(IPCClient):
|
|||
except Exception as exc:
|
||||
log.error('Exception occurred while Subscriber handling stream: {0}'.format(exc))
|
||||
|
||||
@tornado.gen.coroutine
|
||||
def read_async(self, callback):
|
||||
'''
|
||||
Asynchronously read messages and invoke a callback when they are ready.
|
||||
|
@ -695,13 +696,14 @@ class IPCMessageSubscriber(IPCClient):
|
|||
'''
|
||||
while not self.connected():
|
||||
try:
|
||||
self.connect()
|
||||
yield self.connect(timeout=5)
|
||||
except tornado.iostream.StreamClosedError:
|
||||
log.trace('Subscriber closed stream on IPC {0} before connect'.format(self.socket_path))
|
||||
yield tornado.gen.sleep(1)
|
||||
except Exception as exc:
|
||||
log.error('Exception occurred while Subscriber connecting: {0}'.format(exc))
|
||||
|
||||
self.io_loop.spawn_callback(self._read_async, callback)
|
||||
yield tornado.gen.sleep(1)
|
||||
yield self._read_async(callback)
|
||||
|
||||
def close(self):
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue