better handle servers failing to start

including more informative TimeoutError messages
This commit is contained in:
Min RK
2014-11-21 17:51:39 -08:00
parent d6c6ae2c0f
commit cf3a5744e7
2 changed files with 24 additions and 7 deletions

View File

@@ -45,7 +45,9 @@ def wait_for_server(ip, port, timeout=10):
yield gen.Task(loop.add_timeout, loop.time() + 0.1)
else:
return
raise TimeoutError
raise TimeoutError("Server at {ip}:{port} didn't respond in {timeout} seconds".format(
**locals()
))
@gen.coroutine
def wait_for_http_server(url, timeout=10):
@@ -77,7 +79,9 @@ def wait_for_http_server(url, timeout=10):
else:
return
raise TimeoutError
raise TimeoutError("Server at {url} didn't respond in {timeout} seconds".format(
**locals()
))
# Decorators for authenticated Handlers
@@ -166,3 +170,4 @@ def compare_token(compare, token):
return True
return False