You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/06/15 12:00:54 UTC

[GitHub] [superset] dpgaspar commented on a change in pull request #15157: feat: Synchronously return cached charts

dpgaspar commented on a change in pull request #15157:
URL: https://github.com/apache/superset/pull/15157#discussion_r651720097



##########
File path: superset/charts/api.py
##########
@@ -589,7 +593,22 @@ def data(self) -> Response:
             and query_context.result_format == ChartDataResultFormat.JSON
             and query_context.result_type == ChartDataResultType.FULL
         ):
+            # First, look for the chart query results in the cache.
+            try:
+                result = command.run(force_cached=True)
+            except ChartDataCacheLoadError:
+                result = None  # type: ignore
+
+            already_cached_result = result is not None
+
+            # If the chart query has already been cached, return it immediately.
+            if already_cached_result:
+                return self.send_chart_response(result)

Review comment:
       can you add a test for this code path?




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org