Merge pull request #1560 from coreos-inc/redis-down
Switch to generic RedisError
This commit is contained in:
commit
6dd7fe21f9
2 changed files with 8 additions and 8 deletions
|
@ -61,8 +61,8 @@ class RedisBuildLogs(object):
|
||||||
llen = self._redis.llen(self._logs_key(build_id))
|
llen = self._redis.llen(self._logs_key(build_id))
|
||||||
log_entries = self._redis.lrange(self._logs_key(build_id), start_index, -1)
|
log_entries = self._redis.lrange(self._logs_key(build_id), start_index, -1)
|
||||||
return (llen, (json.loads(entry) for entry in log_entries))
|
return (llen, (json.loads(entry) for entry in log_entries))
|
||||||
except redis.ConnectionError as ce:
|
except redis.RedisError as re:
|
||||||
raise BuildStatusRetrievalError('Cannot retrieve build logs: %s' % ce)
|
raise BuildStatusRetrievalError('Cannot retrieve build logs: %s' % re)
|
||||||
|
|
||||||
def expire_log_entries(self, build_id):
|
def expire_log_entries(self, build_id):
|
||||||
"""
|
"""
|
||||||
|
@ -87,8 +87,8 @@ class RedisBuildLogs(object):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
fetched = self._redis.get(self._status_key(build_id))
|
fetched = self._redis.get(self._status_key(build_id))
|
||||||
except redis.ConnectionError as ce:
|
except redis.RedisError as re:
|
||||||
raise BuildStatusRetrievalError('Cannot retrieve build status: %s' % ce)
|
raise BuildStatusRetrievalError('Cannot retrieve build status: %s' % re)
|
||||||
|
|
||||||
return json.loads(fetched) if fetched else None
|
return json.loads(fetched) if fetched else None
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class RedisBuildLogs(object):
|
||||||
connection.get(self._health_key())
|
connection.get(self._health_key())
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except redis.ConnectionError:
|
except redis.RedisError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from redis import ConnectionError
|
from redis import RedisError
|
||||||
from redlock import RedLock, RedLockError
|
from redlock import RedLock, RedLockError
|
||||||
|
|
||||||
from app import app
|
from app import app
|
||||||
|
@ -37,8 +37,8 @@ class GlobalLock(object):
|
||||||
except RedLockError:
|
except RedLockError:
|
||||||
logger.debug('Could not acquire lock %s', self._lock_name)
|
logger.debug('Could not acquire lock %s', self._lock_name)
|
||||||
return False
|
return False
|
||||||
except ConnectionError as ce:
|
except RedisError as re:
|
||||||
logger.debug('Could not connect to Redis for lock %s: %s', self._lock_name, ce)
|
logger.debug('Could not connect to Redis for lock %s: %s', self._lock_name, re)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue