From 6ac12af3438ea7e254d7cbfdc60af0563c6c1cd5 Mon Sep 17 00:00:00 2001 From: Haibo Lin Date: Tue, 9 Jun 2020 11:44:35 +0800 Subject: [PATCH] pkgset: handle exception when using dogpile cache JIRA: RHELCMP-562 Signed-off-by: Haibo Lin --- pungi/phases/pkgset/pkgsets.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/pungi/phases/pkgset/pkgsets.py b/pungi/phases/pkgset/pkgsets.py index 8a1ec1e1..e7dcd755 100644 --- a/pungi/phases/pkgset/pkgsets.py +++ b/pungi/phases/pkgset/pkgsets.py @@ -417,25 +417,29 @@ class KojiPackageSet(PackageSetBase): if not tag: return [], [] + response = None if self.cache_region: cache_key = "KojiPackageSet.get_latest_rpms_%s_%s_%s" % ( - tag, + str(tag), str(event), str(inherit), ) - cached_response = self.cache_region.get(cache_key) - if cached_response: - return cached_response - else: - response = self.koji_proxy.listTaggedRPMS( - tag, event=event, inherit=inherit, latest=True - ) - self.cache_region.set(cache_key, response) - return response - else: - return self.koji_proxy.listTaggedRPMS( + try: + response = self.cache_region.get(cache_key) + except Exception: + pass + + if not response: + response = self.koji_proxy.listTaggedRPMS( tag, event=event, inherit=inherit, latest=True ) + if self.cache_region: + try: + self.cache_region.set(cache_key, response) + except Exception: + pass + + return response def get_package_path(self, queue_item): rpm_info, build_info = queue_item