codeant-ai-for-open-source[bot] commented on code in PR #45895:
URL: https://github.com/apache/superset/pull/45895#discussion_r4431157512
##########
superset/semantic_layers/models.py:
##########
@@ -905,6 +905,23 @@ def get_extra_cache_keys(self, query_obj: QueryObjectDict)
-> list[Hashable]:
keys: list[Hashable] = [self.metadata_generation,
"semantic-null-filters-v1"]
if discriminator is not None:
keys.append(("semantic-result-version", *discriminator))
+
+ from superset import is_feature_enabled
+
+ if is_feature_enabled("CACHE_QUERY_BY_USER"):
+ try:
+ from superset.semantic_layers.execution import (
+ current_host_execution_context,
+ )
+
+ exec_context = current_host_execution_context()
+ if not exec_context.is_guest and exec_context.identity_digest:
+ keys.append(("semantic-user",
exec_context.identity_digest))
+ except Exception as ex:
+ logger.debug(
+ "Could not resolve semantic execution context for cache:
%s", ex
+ )
Review Comment:
✅ **CodeAnt verified this suggestion was addressed in subsequent commits and
marked this thread resolved** as of `3895a3a`.
If resolving the execution context raises an exception while user-based
caching is enabled, the code now adds a fresh `semantic-user-unresolved` UUID
to the cache keys, preventing reuse of another request’s cached results.
<sub>If that's not right, unresolve this thread and CodeAnt will leave it
open.</sub>
<!-- codeant-auto-resolve-reply -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]