Disable the etcd timeout on watch calls to prevent them from disconnecting the client.

This commit is contained in:
Jake Moshenko 2014-12-23 14:54:34 -05:00
parent b2d7fad667
commit 2ed9b3d243

View file

@ -21,6 +21,7 @@ logger = logging.getLogger(__name__)
ETCD_BUILDER_PREFIX = 'building/'
ETCD_EXPIRE_RESULT = 'expire'
ETCD_DISABLE_TIMEOUT = 0
class EphemeralBuilderManager(BaseManager):
@ -52,7 +53,8 @@ class EphemeralBuilderManager(BaseManager):
""" Watch the builders key for expirations.
"""
if not self._shutting_down:
workers_future = self._etcd_client.watch(ETCD_BUILDER_PREFIX, recursive=True)
workers_future = self._etcd_client.watch(ETCD_BUILDER_PREFIX, recursive=True,
timeout=ETCD_DISABLE_TIMEOUT)
workers_future.add_done_callback(self._handle_key_expiration)
logger.debug('Scheduling watch task.')
self._worker_watch_task = async(workers_future)