Skip to content

Commit 4ed05f4

Browse files
authored
fix(be/utils): sync cache timeout for memoized function (apache#31917)
Signed-off-by: hainenber <[email protected]>
1 parent 871cfe0 commit 4ed05f4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

superset/utils/cache.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def sum(a: int, b: int) -> int:
109109
force means whether to force refresh the cache and is treated as False by default,
110110
except force = True is passed to the decorated function.
111111
112-
timeout of cache is set to 600 seconds by default,
112+
timeout of cache is set to CACHE_DEFAULT_TIMEOUT seconds by default,
113113
except cache_timeout = {timeout in seconds} is passed to the decorated function.
114114
115115
:param key: a callable function that takes function arguments and returns
@@ -121,7 +121,9 @@ def wrap(f: Callable[..., Any]) -> Callable[..., Any]:
121121
def wrapped_f(*args: Any, **kwargs: Any) -> Any:
122122
should_cache = kwargs.pop("cache", True)
123123
force = kwargs.pop("force", False)
124-
cache_timeout = kwargs.pop("cache_timeout", 0)
124+
cache_timeout = kwargs.pop(
125+
"cache_timeout", app.config["CACHE_DEFAULT_TIMEOUT"]
126+
)
125127

126128
if not should_cache:
127129
return f(*args, **kwargs)

0 commit comments

Comments
 (0)