parent
e6d214c955
commit
986d20bcad
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))
|
||||
log_entries = self._redis.lrange(self._logs_key(build_id), start_index, -1)
|
||||
return (llen, (json.loads(entry) for entry in log_entries))
|
||||
except redis.ConnectionError as ce:
|
||||
raise BuildStatusRetrievalError('Cannot retrieve build logs: %s' % ce)
|
||||
except redis.RedisError as re:
|
||||
raise BuildStatusRetrievalError('Cannot retrieve build logs: %s' % re)
|
||||
|
||||
def expire_log_entries(self, build_id):
|
||||
"""
|
||||
|
@ -87,8 +87,8 @@ class RedisBuildLogs(object):
|
|||
"""
|
||||
try:
|
||||
fetched = self._redis.get(self._status_key(build_id))
|
||||
except redis.ConnectionError as ce:
|
||||
raise BuildStatusRetrievalError('Cannot retrieve build status: %s' % ce)
|
||||
except redis.RedisError as re:
|
||||
raise BuildStatusRetrievalError('Cannot retrieve build status: %s' % re)
|
||||
|
||||
return json.loads(fetched) if fetched else None
|
||||
|
||||
|
@ -110,7 +110,7 @@ class RedisBuildLogs(object):
|
|||
connection.get(self._health_key())
|
||||
|
||||
return True
|
||||
except redis.ConnectionError:
|
||||
except redis.RedisError:
|
||||
return False
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import logging
|
||||
|
||||
from redis import ConnectionError
|
||||
from redis import RedisError
|
||||
from redlock import RedLock, RedLockError
|
||||
|
||||
from app import app
|
||||
|
@ -37,8 +37,8 @@ class GlobalLock(object):
|
|||
except RedLockError:
|
||||
logger.debug('Could not acquire lock %s', self._lock_name)
|
||||
return False
|
||||
except ConnectionError as ce:
|
||||
logger.debug('Could not connect to Redis for lock %s: %s', self._lock_name, ce)
|
||||
except RedisError as re:
|
||||
logger.debug('Could not connect to Redis for lock %s: %s', self._lock_name, re)
|
||||
return False
|
||||
|
||||
|
||||
|
|
Reference in a new issue