From c568328d72128a5f88195e1e0529c81b41ea1daa Mon Sep 17 00:00:00 2001 From: Julian Bez Date: Fri, 23 Aug 2024 10:00:08 +0100 Subject: [PATCH] fix(insights): Attribute cache warming queries (#24543) --- posthog/caching/warming.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/posthog/caching/warming.py b/posthog/caching/warming.py index 54f997f5dc438..681cb773ff871 100644 --- a/posthog/caching/warming.py +++ b/posthog/caching/warming.py @@ -125,7 +125,7 @@ def schedule_warming_for_teams_task(): retry_backoff_max=3, max_retries=3, ) -def warm_insight_cache_task(insight_id: int, dashboard_id: int): +def warm_insight_cache_task(insight_id: int, dashboard_id: Optional[int]): insight = Insight.objects.get(pk=insight_id) dashboard = None @@ -146,6 +146,8 @@ def warm_insight_cache_task(insight_id: int, dashboard_id: int): # - in case someone refreshed after this task was triggered # - if insight + dashboard combinations have the same cache key, we prevent needless recalculations execution_mode=ExecutionMode.RECENT_CACHE_CALCULATE_BLOCKING_IF_STALE, + insight_id=insight_id, + dashboard_id=dashboard_id, ) PRIORITY_INSIGHTS_COUNTER.labels(