mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Don't unsubscribe, there is no need to and it leaves zeromq
in the wrong state for a few moments and breaks the client
This commit is contained in:
parent
62d69de30e
commit
923130d827
@ -207,10 +207,7 @@ class LocalClient(object):
|
||||
timeout=self._get_timeout(timeout),
|
||||
**kwargs)
|
||||
|
||||
try:
|
||||
return self._check_pub_data(pub_data)
|
||||
finally:
|
||||
self.event.unsubscribe(jid)
|
||||
return self._check_pub_data(pub_data)
|
||||
|
||||
def cmd_async(
|
||||
self,
|
||||
|
@ -147,24 +147,20 @@ class SaltEvent(object):
|
||||
wait = wait * 1000
|
||||
|
||||
self.subscribe(tag)
|
||||
try:
|
||||
while True:
|
||||
socks = dict(self.poller.poll(wait))
|
||||
if self.sub in socks and socks[self.sub] == zmq.POLLIN:
|
||||
raw = self.sub.recv()
|
||||
# Double check the tag
|
||||
if tag != raw[:20].rstrip('|'):
|
||||
continue
|
||||
data = self.serial.loads(raw[20:])
|
||||
if full:
|
||||
ret = {'data': data,
|
||||
'tag': raw[:20].rstrip('|')}
|
||||
return ret
|
||||
return data
|
||||
return None
|
||||
finally:
|
||||
# No sense in keeping subscribed to this event
|
||||
self.unsubscribe(tag)
|
||||
while True:
|
||||
socks = dict(self.poller.poll(wait))
|
||||
if self.sub in socks and socks[self.sub] == zmq.POLLIN:
|
||||
raw = self.sub.recv()
|
||||
# Double check the tag
|
||||
if tag != raw[:20].rstrip('|'):
|
||||
continue
|
||||
data = self.serial.loads(raw[20:])
|
||||
if full:
|
||||
ret = {'data': data,
|
||||
'tag': raw[:20].rstrip('|')}
|
||||
return ret
|
||||
return data
|
||||
return None
|
||||
|
||||
def iter_events(self, tag='', full=False):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user