mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #14998 from cachedout/event_block
Do not use non_blocking mode on master event bus
This commit is contained in:
commit
062e67943d
@ -290,7 +290,8 @@ class SaltEvent(object):
|
||||
continue
|
||||
|
||||
try:
|
||||
ret = self.get_event_noblock()
|
||||
ret = self.get_event_block() # Please do not use non-blocking mode here.
|
||||
# Reliability is more important than pure speed on the event bus.
|
||||
except zmq.ZMQError as ex:
|
||||
if ex.errno == errno.EAGAIN or ex.errno == errno.EINTR:
|
||||
continue
|
||||
@ -353,6 +354,14 @@ class SaltEvent(object):
|
||||
mtag, data = self.unpack(raw, self.serial)
|
||||
return {'data': data, 'tag': mtag}
|
||||
|
||||
def get_event_block(self):
|
||||
'''Get the raw event in a blocking fashion
|
||||
Slower, but decreases the possibility of dropped events
|
||||
'''
|
||||
raw = self.sub.recv()
|
||||
mtag, data = self.unpack(raw, self.serial)
|
||||
return {'data': data, 'tag': mtag}
|
||||
|
||||
def iter_events(self, tag='', full=False):
|
||||
'''
|
||||
Creates a generator that continuously listens for events
|
||||
|
Loading…
Reference in New Issue
Block a user