From f997d24cfad5ec9e71a96079973c871fc4772696 Mon Sep 17 00:00:00 2001 From: Thomas Jackson Date: Tue, 28 Oct 2014 17:19:43 -0700 Subject: [PATCH] Change syndic_wait in get_iter_returns This will ensure we only do the quick return if you are *not* a syndic, since when you are a syndic we have no idea what the target is-- so we have to wait. This means that syndic masters (the master of masters) will have at least syndic_wait seconds until the return comes back --- salt/client/__init__.py | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/salt/client/__init__.py b/salt/client/__init__.py index f53b2c075e..e150b5e808 100644 --- a/salt/client/__init__.py +++ b/salt/client/__init__.py @@ -887,23 +887,11 @@ class LocalClient(object): log.debug('jid {0} return from {1}'.format(jid, raw['data']['id'])) yield ret - # if we have all of the returns, no need for anything fancy - if len(found.intersection(minions)) >= len(minions): - # if you are a master of masters - if (self.opts['order_masters'] and - # and if you have more syndic_wait to add - syndic_wait < self.opts.get('syndic_wait', 1) and - # add you would have timed out - time.time() >= timeout_at): - syndic_wait += 1 - # add one, so as to only add a max of opts['syndic_wait'] - timeout_at += 1 - log.debug('jid {0} syndic_wait {1} will now timeout at {2}'.format( - jid, syndic_wait, datetime.fromtimestamp(timeout_at).time())) - else: - # All minions have returned, break out of the loop - log.debug('jid {0} found all minions {1}'.format(jid, found)) - break + # if we have all of the returns (and we aren't a syndic), no need for anything fancy + if len(found.intersection(minions)) >= len(minions) and not self.opts['order_masters']: + # All minions have returned, break out of the loop + log.debug('jid {0} found all minions {1}'.format(jid, found)) + break # let start the timeouts for all remaining minions for id_ in minions - found: @@ -933,6 +921,9 @@ class LocalClient(object): else: jinfo_iter = self.get_returns_no_block(jinfo['jid'], event=event) timeout_at = time.time() + self.opts['gather_job_timeout'] + # if you are a syndic, wait a little longer + if self.opts['order_masters']: + timeout_at += self.opts.get('syndic_wait', 1) # check for minions that are running the job still for raw in jinfo_iter: