mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
Pass in cache timeout for async queries (#4436)
* Pass in cache timeout for async queries * Default cache timeout to 0 if default env var is not set * check for 0 timeout
This commit is contained in:
parent
0c87e23877
commit
7922ccfddc
@ -272,7 +272,10 @@ def execute_sql(
|
|||||||
key = '{}'.format(uuid.uuid4())
|
key = '{}'.format(uuid.uuid4())
|
||||||
logging.info('Storing results in results backend, key: {}'.format(key))
|
logging.info('Storing results in results backend, key: {}'.format(key))
|
||||||
json_payload = json.dumps(payload, default=utils.json_iso_dttm_ser)
|
json_payload = json.dumps(payload, default=utils.json_iso_dttm_ser)
|
||||||
results_backend.set(key, utils.zlib_compress(json_payload))
|
cache_timeout = database.cache_timeout
|
||||||
|
if cache_timeout is None:
|
||||||
|
cache_timeout = config.get('CACHE_DEFAULT_TIMEOUT', 0)
|
||||||
|
results_backend.set(key, utils.zlib_compress(json_payload), cache_timeout)
|
||||||
query.results_key = key
|
query.results_key = key
|
||||||
query.end_result_backend_time = utils.now_as_float()
|
query.end_result_backend_time = utils.now_as_float()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user