mirror of
https://github.com/apache/superset.git
synced 2026-06-03 14:49:23 +00:00
fix(GAQ): don't use async queries when cache timeout is -1 (#38089)
This commit is contained in:
committed by
GitHub
parent
aa475734ef
commit
e4a7cd30c3
@@ -46,6 +46,7 @@ from superset.commands.chart.exceptions import (
|
||||
)
|
||||
from superset.common.chart_data import ChartDataResultFormat, ChartDataResultType
|
||||
from superset.connectors.sqla.models import BaseDatasource
|
||||
from superset.constants import CACHE_DISABLED_TIMEOUT
|
||||
from superset.daos.exceptions import DatasourceNotFound
|
||||
from superset.exceptions import QueryObjectValidationError
|
||||
from superset.extensions import event_logger
|
||||
@@ -171,11 +172,16 @@ class ChartDataRestApi(ChartRestApi):
|
||||
)
|
||||
|
||||
# TODO: support CSV, SQL query and other non-JSON types
|
||||
if (
|
||||
# Don't use async queries when cache is disabled (cache_timeout=-1)
|
||||
# as async queries depend on caching to retrieve results
|
||||
cache_timeout = query_context.get_cache_timeout()
|
||||
use_async = (
|
||||
is_feature_enabled("GLOBAL_ASYNC_QUERIES")
|
||||
and query_context.result_format == ChartDataResultFormat.JSON
|
||||
and query_context.result_type == ChartDataResultType.FULL
|
||||
):
|
||||
and cache_timeout != CACHE_DISABLED_TIMEOUT
|
||||
)
|
||||
if use_async:
|
||||
return self._run_async(json_body, command, add_extra_log_payload)
|
||||
|
||||
try:
|
||||
@@ -265,11 +271,16 @@ class ChartDataRestApi(ChartRestApi):
|
||||
)
|
||||
|
||||
# TODO: support CSV, SQL query and other non-JSON types
|
||||
if (
|
||||
# Don't use async queries when cache is disabled (cache_timeout=-1)
|
||||
# as async queries depend on caching to retrieve results
|
||||
cache_timeout = query_context.get_cache_timeout()
|
||||
use_async = (
|
||||
is_feature_enabled("GLOBAL_ASYNC_QUERIES")
|
||||
and query_context.result_format == ChartDataResultFormat.JSON
|
||||
and query_context.result_type == ChartDataResultType.FULL
|
||||
):
|
||||
and cache_timeout != CACHE_DISABLED_TIMEOUT
|
||||
)
|
||||
if use_async:
|
||||
return self._run_async(json_body, command, add_extra_log_payload)
|
||||
|
||||
form_data = json_body.get("form_data")
|
||||
|
||||
Reference in New Issue
Block a user