Skip to content

Commit

Permalink
agent: handle redis TimeoutError
Browse files Browse the repository at this point in the history
  • Loading branch information
assafgi committed Nov 20, 2019
1 parent b3c0cc7 commit 77f8275
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion talker_agent/talker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from configparser import ConfigParser

import redis
from redis import TimeoutError


def reraise(tp, value, tb=None):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 77f8275

Please sign in to comment.