From 158232ab810ca758759026cf6eb8df3c6fd4e51e Mon Sep 17 00:00:00 2001 From: Mike McLean Date: May 10 2021 07:51:03 +0000 Subject: protonmsg: avoid calling _send_msgs on empty list --- diff --git a/plugins/hub/protonmsg.py b/plugins/hub/protonmsg.py index 7c6dad0..27df6d0 100644 --- a/plugins/hub/protonmsg.py +++ b/plugins/hub/protonmsg.py @@ -351,9 +351,10 @@ def handle_db_msgs(urls, CONFIG): columns=('id', 'address', 'props', 'body'), opts={'order': 'id', 'limit': limit}) msgs = list(query.execute()) + if not msgs: + return if CONFIG.getboolean('broker', 'test_mode', fallback=False): - if msgs: - LOG.debug('test mode: skipping send for %i messages from db', len(msgs)) + LOG.debug('test mode: skipping send for %i messages from db', len(msgs)) unsent = [] else: unsent = {m['id'] for m in _send_msgs(urls, msgs, CONFIG)}