You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using @cache decorator across my Flask=3.0.0 web application actively with Flask-Caching==2.2.0. In production I frequently see the following errors (not reproducible)
2024-06-15 09:22:57,337: Exception possibly due to cache backend.
Traceback (most recent call last):
File "/python3.9/site-packages/flask_caching/__init__.py", line 420, in decorated_function
self.cache.set(
File "/python3.9/site-packages/cachelib/simple.py", line 79, in set
self._prune()
File "/python3.9/site-packages/cachelib/simple.py", line 56, in _prune
self._remove_expired(now)
File "/python3.9/site-packages/cachelib/simple.py", line 37, in _remove_expired
toremove = [k for k, (expires, _) in self._cache.items() if expires < now]
File "/python3.9/site-packages/cachelib/simple.py", line 37, in <listcomp>
toremove = [k for k, (expires, _) in self._cache.items() if expires < now]
RuntimeError: dictionary keys changed during iteration
Since it is a decorator and I don't control pruning cache, I suspect there could be a bug in the library or its dependencies. Please advice. Happy to fix it myself here if you guide me to the potential problem.
The text was updated successfully, but these errors were encountered:
I am using @cache decorator across my Flask=3.0.0 web application actively with Flask-Caching==2.2.0. In production I frequently see the following errors (not reproducible)
Example:
@cache.cached(timeout=3600, key_prefix=make_cache_key)
Since it is a decorator and I don't control pruning cache, I suspect there could be a bug in the library or its dependencies. Please advice. Happy to fix it myself here if you guide me to the potential problem.
The text was updated successfully, but these errors were encountered: