fix(caching): filter kwargs in async_get_cache to match sync get_cache

This commit is contained in:
devin-ai-integration[bot] 2026-07-01 04:08:17 +00:00 • committed by GitHub
parent cca71a07c2
commit f870d7cee3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -619,12 +619,17 @@ class Cache:
else:
cache_key = self.get_cache_key(**kwargs)
if cache_key is not None:
cache_control_args = kwargs.get("cache", {})
max_age = cache_control_args.get("s-max-age", cache_control_args.get("s-maxage", float("inf")))
cache_control_args: DynamicCacheControl = kwargs.get("cache", {})
max_age = cache_control_args.get("s-maxage") or cache_control_args.get("s-max-age") or float("inf")
cache_lookup_kwargs = self._get_safe_cache_lookup_kwargs(kwargs)
if dynamic_cache_object is not None:
cached_result = await dynamic_cache_object.async_get_cache(cache_key, **kwargs)
cached_result = await dynamic_cache_object.async_get_cache(cache_key, **cache_lookup_kwargs)
else:
cached_result = await self.cache.async_get_cache(cache_key, **kwargs)
cached_result = await self.cache.async_get_cache(cache_key, **cache_lookup_kwargs)
self._update_metadata_from_cache_lookup_kwargs(
original_kwargs=kwargs,
cache_lookup_kwargs=cache_lookup_kwargs,
)
return self._get_cache_logic(cached_result=cached_result, max_age=max_age)
except Exception:
print_verbose(f"An exception occurred: {traceback.format_exc()}")