From 30f9d08aa8a261237f99f1e1980e21ec6344e706 Mon Sep 17 00:00:00 2001 From: Colton Myers Date: Thu, 19 Mar 2015 10:42:06 -0600 Subject: [PATCH] Pop oldest jid if we hit the jid_forward_cache_hwm --- salt/minion.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/salt/minion.py b/salt/minion.py index c636b12781..de09af1d56 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -2313,6 +2313,11 @@ class MultiSyndic(MinionBase): if event['data']['jid'] not in self.jid_forward_cache: fstr = '{0}.get_load'.format(self.opts['master_job_cache']) 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) jdict['__load__'].update( self.mminion.returners[fstr](event['data']['jid']) )