Merge pull request #14998 from cachedout/event_block

Do not use non_blocking mode on master event bus
This commit is contained in:
Thomas S Hatch 2014-08-15 00:01:48 -06:00
commit 062e67943d

View File

@ -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