def wait(self, timeout=None):
time_limit = None
if timeout is not None:
time_limit = time.time() + timeout
barrier_lifted = self.client.wait_for_event(
WatchEvent.DELETED, self.path
)
if time_limit:
barrier_lifted = gen.with_timeout(time_limit, barrier_lifted)
exists = yield self.client.exists(path=self.path, watch=True)
if not exists:
return
try:
yield barrier_lifted
except gen.TimeoutError:
raise exc.TimeoutError
评论列表
文章目录