Skip to content

Commit 8dc9b80

Browse files
committed
Setup the cache sooner
Signed-off-by: Pedro Algarvio <[email protected]>
1 parent 53c12d4 commit 8dc9b80

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/saf/process/job_aggregate.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,16 @@ async def process(
6464
"""
6565
Aggregate received events, otherwise store in cache.
6666
"""
67+
if "watched_jids" not in ctx.cache:
68+
ctx.cache["watched_jids"] = {}
69+
if "waiting_for_grains" not in ctx.cache:
70+
ctx.cache["waiting_for_grains"] = {}
6771
if isinstance(event, EventBusCollectedEvent):
6872
log.debug("Event Bus Collected Event:\n%s", pprint.pformat(event.dict()))
6973
salt_event = event.salt_event
7074
log.debug("Event Bus Collected Salt Event:\n%s", pprint.pformat(salt_event))
7175
tag = salt_event.tag
7276
data = salt_event.data
73-
if "watched_jids" not in ctx.cache:
74-
ctx.cache["watched_jids"] = {}
75-
if "waiting_for_grains" not in ctx.cache:
76-
ctx.cache["waiting_for_grains"] = {}
7777
if fnmatch.fnmatch(tag, "salt/job/*/new"):
7878
jid = tag.split("/")[2]
7979
# We will probably want to make this condition configurable

0 commit comments

Comments
 (0)