File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -436,7 +436,17 @@ def cache_key(self, **extra: Any) -> str: # noqa: C901
436436 if self .time_range :
437437 cache_dict ["time_range" ] = self .time_range
438438 if self .post_processing :
439- cache_dict ["post_processing" ] = self .post_processing
439+ # Exclude contribution_totals from post_processing as it's computed at
440+ # runtime and varies per request, which would cause cache key mismatches
441+ post_processing_for_cache = []
442+ for pp in self .post_processing :
443+ pp_copy = dict (pp )
444+ if pp_copy .get ("operation" ) == "contribution" and "options" in pp_copy :
445+ options = dict (pp_copy ["options" ])
446+ options .pop ("contribution_totals" , None )
447+ pp_copy ["options" ] = options
448+ post_processing_for_cache .append (pp_copy )
449+ cache_dict ["post_processing" ] = post_processing_for_cache
440450 if self .time_offsets :
441451 cache_dict ["time_offsets" ] = self .time_offsets
442452
You can’t perform that action at this time.
0 commit comments