greenwave: Use pymemcache as cache backend

Uses the dogpile cache backend that is now installed in the new
greenwave container images.

This replaces the old python-memcached backend which has not been
updated in many years and we has some compatibility issues
(https://github.com/linsomniac/python-memcached/issues/176).
This commit is contained in:
Lukas Holecek 2022-10-03 07:30:07 +02:00 committed by kevin
parent 40633757bf
commit 42b91b718b

View file

@ -30,11 +30,20 @@ CORS_URL = 'https://bodhi.fedoraproject.org'
MESSAGING = "fedora-messaging"
{% endif %}
# TODO: This is for backwards compatibility. Remove in the near future.
import importlib # noqa: E402
if importlib.util.find_spec("pymemcache") is None:
greenwave_cache_backend = "dogpile.cache.memcached"
else:
greenwave_cache_backend = "dogpile.cache.pymemcache"
CACHE = {
'backend': 'dogpile.cache.memcached',
'backend': greenwave_cache_backend,
'expiration_time': 3600, # 3600 is 1 hour
'arguments': {
'url': 'greenwave-memcached:11211',
'distributed_lock': True
'distributed_lock': True,
# Release lock in case the owner was terminated.
'lock_timeout': 120,
}
}