mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-03 23:09:17 +02:00
Revert to apline:3.11 to stay on Python 3.7 (3.8 has issues with channels)
This commit is contained in:
parent
9a2876469a
commit
14d5b0c69c
5 changed files with 39 additions and 5 deletions
29
api/funkwhale_api/common/cache.py
Normal file
29
api/funkwhale_api/common/cache.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
import logging
|
||||
|
||||
from django_redis.client import default
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RedisClient(default.DefaultClient):
|
||||
def get(self, key, default=None, version=None, client=None):
|
||||
try:
|
||||
return super().get(key, default=None, version=None, client=None)
|
||||
except ValueError as e:
|
||||
if "unsupported pickle protocol" in str(e):
|
||||
# pickle deserialization error
|
||||
logger.warn("Error while deserializing pickle value from cache")
|
||||
return default
|
||||
else:
|
||||
raise
|
||||
|
||||
def get_many(self, *args, **kwargs):
|
||||
try:
|
||||
return super().get_many(*args, **kwargs)
|
||||
except ValueError as e:
|
||||
if "unsupported pickle protocol" in str(e):
|
||||
# pickle deserialization error
|
||||
logger.warn("Error while deserializing pickle value from cache")
|
||||
return {}
|
||||
else:
|
||||
raise
|
Loading…
Add table
Add a link
Reference in a new issue