Make changes in both MultiSyndic and Syndic

This commit is contained in:
Colton Myers 2015-03-19 13:54:22 -06:00
parent 07c354bd27
commit 06c3cf8fc1

View File

@ -2074,9 +2074,18 @@ class Syndic(Minion):
jdict['__jid__'] = event['data']['jid']
jdict['__load__'] = {}
fstr = '{0}.get_jid'.format(self.opts['master_job_cache'])
# Only need to forward each load once. Don't hit the disk
# for every minion return!
if event['data']['jid'] not in self.jid_forward_cache:
jdict['__load__'].update(
self.mminion.returners[fstr](event['data']['jid'])
)
self.jid_forward_cache.add(event['data']['jid'])
if len(self.jid_forward_cache) > self.opts['syndic_jid_forward_cache_hwm']:
# Pop the oldest jid from the cache
tmp = sorted(list(self.jid_forward_cache))
tmp.pop(0)
self.jid_forward_cache = set(tmp)
if 'master_id' in event['data']:
jdict['master_id'] = event['data']['master_id']
jdict[event['data']['id']] = event['data']['return']
@ -2129,6 +2138,7 @@ class MultiSyndic(MinionBase):
opts['loop_interval'] = 1
super(MultiSyndic, self).__init__(opts)
self.mminion = salt.minion.MasterMinion(opts)
self.jid_forward_cache = set()
# create all of the syndics you need
self.master_syndics = {}