From 77f8275a352587fb92dfc7a9032c1f9ddcbbdbf5 Mon Sep 17 00:00:00 2001 From: Assaf Giladi Date: Wed, 20 Nov 2019 17:59:54 +0200 Subject: [PATCH] agent: handle redis TimeoutError --- talker_agent/talker.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/talker_agent/talker.py b/talker_agent/talker.py index 24dfc57..5c355c8 100644 --- a/talker_agent/talker.py +++ b/talker_agent/talker.py @@ -22,6 +22,7 @@ from configparser import ConfigParser import redis +from redis import TimeoutError def reraise(tp, value, tb=None): @@ -534,7 +535,11 @@ def fetch_new_jobs(self): jobs_key = 'commands-%s' % self.host_id while not self.stop_fetching.is_set(): new_jobs = [] - ret = self.redis.blpop([jobs_key], timeout=1) + try: + ret = self.redis.blpop([jobs_key], timeout=1) + except TimeoutError as e: + logger.error(e, exc_info=True) + ret = None if not ret: now = time.time() self.scrub_seen_jobs(now=now)