Add exception handling that doesn't log the read-timeout exception
Note: This is a *hack* and needs to be replaced with proper code ASAP
This commit is contained in:
parent
75b36c0f33
commit
6655c7f745
1 changed files with 12 additions and 3 deletions
|
@ -87,9 +87,6 @@ class EphemeralBuilderManager(BaseManager):
|
||||||
except ReadTimeoutError:
|
except ReadTimeoutError:
|
||||||
logger.debug('Read-timeout on etcd watch %s, rescheduling', etcd_key)
|
logger.debug('Read-timeout on etcd watch %s, rescheduling', etcd_key)
|
||||||
|
|
||||||
except (ProtocolError, etcd.EtcdException):
|
|
||||||
logger.exception('Exception on etcd watch: %s', etcd_key)
|
|
||||||
|
|
||||||
except etcd.EtcdEventIndexCleared:
|
except etcd.EtcdEventIndexCleared:
|
||||||
# This happens if etcd2 has moved forward too fast for us to start watching
|
# This happens if etcd2 has moved forward too fast for us to start watching
|
||||||
# at the index we retrieved. We therefore start a new watch at HEAD and
|
# at the index we retrieved. We therefore start a new watch at HEAD and
|
||||||
|
@ -101,6 +98,18 @@ class EphemeralBuilderManager(BaseManager):
|
||||||
if restarter is not None:
|
if restarter is not None:
|
||||||
async(restarter())
|
async(restarter())
|
||||||
|
|
||||||
|
except etcd.EtcdException as eex:
|
||||||
|
# TODO(jschorr): This is a quick and dirty hack and should be replaced
|
||||||
|
# with a proper exception check.
|
||||||
|
if str(eex.message).find('Read timed out') >= 0:
|
||||||
|
logger.debug('Read-timeout on etcd watch %s, rescheduling', etcd_key)
|
||||||
|
else:
|
||||||
|
logger.exception('Exception on etcd watch: %s', etcd_key)
|
||||||
|
|
||||||
|
except ProtocolError:
|
||||||
|
logger.exception('Exception on etcd watch: %s', etcd_key)
|
||||||
|
|
||||||
|
|
||||||
if watch_task_key not in self._watch_tasks or self._watch_tasks[watch_task_key].done():
|
if watch_task_key not in self._watch_tasks or self._watch_tasks[watch_task_key].done():
|
||||||
self._watch_etcd(etcd_key, change_callback, start_index=new_index, restarter=restarter)
|
self._watch_etcd(etcd_key, change_callback, start_index=new_index, restarter=restarter)
|
||||||
|
|
||||||
|
|
Reference in a new issue