From 42b91b718b3cc5da259cdfed813866051d87a974 Mon Sep 17 00:00:00 2001 From: Lukas Holecek Date: Mon, 3 Oct 2022 07:30:07 +0200 Subject: [PATCH] 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). --- .../openshift-apps/greenwave/templates/settings.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/roles/openshift-apps/greenwave/templates/settings.py b/roles/openshift-apps/greenwave/templates/settings.py index 46aa41c450..bc1ec85796 100644 --- a/roles/openshift-apps/greenwave/templates/settings.py +++ b/roles/openshift-apps/greenwave/templates/settings.py @@ -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, } }