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:
Joseph Schorr 2015-06-25 23:35:29 -04:00
parent 75b36c0f33
commit 6655c7f745

View file

@ -87,9 +87,6 @@ class EphemeralBuilderManager(BaseManager):
except ReadTimeoutError:
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:
# 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
@ -101,6 +98,18 @@ class EphemeralBuilderManager(BaseManager):
if restarter is not None:
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():
self._watch_etcd(etcd_key, change_callback, start_index=new_index, restarter=restarter)