betodealmeida commented on a change in pull request #10963:
URL:
https://github.com/apache/incubator-superset/pull/10963#discussion_r496297046
##########
File path: superset/utils/decorators.py
##########
@@ -89,13 +94,26 @@ def wrapper(*args: Any, **kwargs: Any) -> ETagResponseMixin:
raise
logger.exception("Exception possibly due to cache
backend.")
+ # if cache is stale?
+ if get_latest_changed_on:
+ content_changed_time = get_latest_changed_on(*args, **kwargs)
+ if (
+ response
+ and response.last_modified
+ and response.last_modified.timestamp()
+ < content_changed_time.timestamp()
+ ):
+ response = None
+ else:
+ content_changed_time = datetime.utcnow()
Review comment:
I know generalizing too soon is not a good practice, but I wonder if we
should pass a callable called `is_stale` here. It would simplify the decorator
logic, and since it would be defined closer to the dashboard it might simplify
the logic there as well.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]