You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2025/05/12 15:08:43 UTC
(superset) 14/14: fix(be/utils): sync cache timeout for memoized function (#31917)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch 5.0
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 8ffcd7e960970af147ff6122eefbdf7f1faffa8f
Author: Đỗ Trọng Hải <41...@users.noreply.github.com>
AuthorDate: Thu May 8 04:45:15 2025 +0700
fix(be/utils): sync cache timeout for memoized function (#31917)
Signed-off-by: hainenber <do...@gmail.com>
(cherry picked from commit 4ed05f4ff16805b1253a902172a53e973cf41f1e)
---
superset/utils/cache.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/superset/utils/cache.py b/superset/utils/cache.py
index 87a74dd6e2..93072e6a53 100644
--- a/superset/utils/cache.py
+++ b/superset/utils/cache.py
@@ -109,7 +109,7 @@ def memoized_func(key: str, cache: Cache = cache_manager.cache) -> Callable[...,
force means whether to force refresh the cache and is treated as False by default,
except force = True is passed to the decorated function.
- timeout of cache is set to 600 seconds by default,
+ timeout of cache is set to CACHE_DEFAULT_TIMEOUT seconds by default,
except cache_timeout = {timeout in seconds} is passed to the decorated function.
:param key: a callable function that takes function arguments and returns
@@ -121,7 +121,9 @@ def memoized_func(key: str, cache: Cache = cache_manager.cache) -> Callable[...,
def wrapped_f(*args: Any, **kwargs: Any) -> Any:
should_cache = kwargs.pop("cache", True)
force = kwargs.pop("force", False)
- cache_timeout = kwargs.pop("cache_timeout", 0)
+ cache_timeout = kwargs.pop(
+ "cache_timeout", app.config["CACHE_DEFAULT_TIMEOUT"]
+ )
if not should_cache:
return f(*args, **kwargs)