From a6225ad34aaab6ac67257534e049a1c92f95fdd6 Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Mon, 22 Sep 2014 18:42:22 -0400 Subject: [PATCH] Set an aggressive timeout on the redis connections to allow the unit tests to run when communication with redis is disabled. --- data/buildlogs.py | 2 +- data/userevent.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/buildlogs.py b/data/buildlogs.py index 9128390af..b33f25559 100644 --- a/data/buildlogs.py +++ b/data/buildlogs.py @@ -17,7 +17,7 @@ class RedisBuildLogs(object): PHASE = 'phase' def __init__(self, redis_host): - self._redis = redis.StrictRedis(host=redis_host) + self._redis = redis.StrictRedis(host=redis_host, socket_timeout=5) @staticmethod def _logs_key(build_id): diff --git a/data/userevent.py b/data/userevent.py index bcdafd078..d137eac04 100644 --- a/data/userevent.py +++ b/data/userevent.py @@ -44,7 +44,7 @@ class UserEvent(object): as backed by Redis. """ def __init__(self, redis_host, username): - self._redis = redis.StrictRedis(host=redis_host) + self._redis = redis.StrictRedis(host=redis_host, socket_timeout=5) self._username = username @staticmethod @@ -77,7 +77,7 @@ class UserEventListener(object): def __init__(self, redis_host, username, events=set([])): channels = [self._user_event_key(username, e) for e in events] - self._redis = redis.StrictRedis(host=redis_host) + self._redis = redis.StrictRedis(host=redis_host, socket_timeout=5) self._pubsub = self._redis.pubsub() self._pubsub.subscribe(channels)