diff --git a/buildman/manager/ephemeral.py b/buildman/manager/ephemeral.py index 90cd1cd68..0d1c482e2 100644 --- a/buildman/manager/ephemeral.py +++ b/buildman/manager/ephemeral.py @@ -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)