From ff500a2c4e0ffb4a8a57184aca54580a6f3670db Mon Sep 17 00:00:00 2001 From: Jana Cupova Date: Wed, 27 Apr 2022 12:16:28 +0200 Subject: [PATCH] Age in protonmsg config file is deprecated Fixes: https://pagure.io/koji/issue/3332 --- plugins/hub/protonmsg.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/hub/protonmsg.py b/plugins/hub/protonmsg.py index 702028e4..3b90a3ff 100644 --- a/plugins/hub/protonmsg.py +++ b/plugins/hub/protonmsg.py @@ -361,8 +361,12 @@ def handle_db_msgs(urls, CONFIG): LOG.debug('skipping db queue due to lock') return try: - c.execute("DELETE FROM proton_queue WHERE created_ts < NOW() -'%s hours'::interval" % - CONFIG.getint('queue', 'age', fallback=24)) + max_age = CONFIG.getint('queue', 'max_age', fallback=None) + if not max_age: + # age in config file is deprecated + max_age = CONFIG.getint('queue', 'age', fallback=24) + c.execute("DELETE FROM proton_queue WHERE created_ts < NOW() -'%s hours'::interval" + % max_age) query = QueryProcessor(tables=('proton_queue',), columns=('id', 'address', 'props', 'body::TEXT'), aliases=('id', 'address', 'props', 'body'),