fixes 29817

Makes sure we unsubscribe from self.events and also dereference the job info iterator
This commit is contained in:
charles_paclat 2016-03-25 11:40:24 -04:00
parent b84908d51f
commit 5d970ca031

View file

@ -667,6 +667,8 @@ class LocalClient(object):
continue
yield fn_ret
self._clean_up_subscriptions(pub_data['jid'])
def cmd_iter_no_block(
self,
tgt,
@ -721,6 +723,8 @@ class LocalClient(object):
**kwargs):
yield fn_ret
self._clean_up_subscriptions(pub_data['jid'])
def cmd_full_return(
self,
tgt,
@ -802,6 +806,7 @@ class LocalClient(object):
found.update(set(event))
yield event
if len(found.intersection(minions)) >= len(minions):
self._clean_up_subscriptions(jid)
raise StopIteration()
# TODO: tests!!
@ -951,6 +956,8 @@ class LocalClient(object):
for raw in jinfo_iter:
# if there are no more events, lets stop waiting for the jinfo
if raw is None:
self.event.unsubscribe(jinfo['jid'])
jinfo_iter = []
break
# TODO: move to a library??
@ -1217,6 +1224,8 @@ class LocalClient(object):
}
break
time.sleep(0.01)
self._clean_up_subscriptions(jid)
return ret
def get_cli_event_returns(
@ -1275,6 +1284,8 @@ class LocalClient(object):
else:
yield {id_: min_ret}
self._clean_up_subscriptions(jid)
def get_event_iter_returns(self, jid, minions, timeout=None):
'''
Gather the return data from the event system, break hard when timeout
@ -1476,6 +1487,10 @@ class LocalClient(object):
# The call below will take care of calling 'self.event.destroy()'
del self.event
def _clean_up_subscriptions(self, job_id):
if self.opts.get('order_masters'):
self.event.unsubscribe('syndic/.*/{0}'.format(job_id), 'regex')
self.event.unsubscribe('salt/job/{0}'.format(job_id))
class FunctionWrapper(dict):
'''