fix: timeout should be an integer (#23924)

This commit is contained in:
Beto Dealmeida 2023-05-03 13:33:00 -07:00 committed by GitHub
parent 842659dbfe
commit ad19cd9fbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -95,8 +95,7 @@ def view_cache_key(*args: Any, **kwargs: Any) -> str: # pylint: disable=unused-
def memoized_func(
key: Optional[str] = None,
cache: Cache = cache_manager.cache,
key: Optional[str] = None, cache: Cache = cache_manager.cache
) -> Callable[..., Any]:
"""
Decorator with configurable key and cache backend.
@ -143,7 +142,7 @@ def memoized_func(
if not kwargs.get("force") and obj is not None:
return obj
obj = f(*args, **kwargs)
cache.set(cache_key, obj, timeout=kwargs.get("cache_timeout"))
cache.set(cache_key, obj, timeout=kwargs.get("cache_timeout", 0))
return obj
return wrapped_f