From 285c1b5d2275b168ef7c8564ff2e1397ee22ade2 Mon Sep 17 00:00:00 2001 From: Yongjie Zhao Date: Thu, 1 Jul 2021 12:04:46 +0100 Subject: [PATCH] fix: skip set and log when NullCache (#15493) --- superset/utils/cache.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/superset/utils/cache.py b/superset/utils/cache.py index 2ad54ede1..4b5c12e19 100644 --- a/superset/utils/cache.py +++ b/superset/utils/cache.py @@ -21,6 +21,7 @@ from typing import Any, Callable, Dict, Optional, Union from flask import current_app as app, request from flask_caching import Cache +from flask_caching.backends import NullCache from werkzeug.wrappers.etag import ETagResponseMixin from superset import db @@ -47,6 +48,9 @@ def set_and_log_cache( cache_timeout: Optional[int] = None, datasource_uid: Optional[str] = None, ) -> None: + if isinstance(cache_instance.cache, NullCache): + return + timeout = cache_timeout if cache_timeout else config["CACHE_DEFAULT_TIMEOUT"] try: dttm = datetime.utcnow().isoformat().split(".")[0]