mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
fixes 29817
Makes sure we unsubscribe from self.events and also dereference the job info iterator
This commit is contained in:
parent
b84908d51f
commit
5d970ca031
1 changed files with 15 additions and 0 deletions
|
@ -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):
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue