diff --git a/jupyterhub/objects.py b/jupyterhub/objects.py index 75a8391d..c76e4ace 100644 --- a/jupyterhub/objects.py +++ b/jupyterhub/objects.py @@ -111,13 +111,12 @@ class Server(HasTraits): return self.url.replace(self._connect_ip, self.ip or '*', 1) return self.url - @gen.coroutine def wait_up(self, timeout=10, http=False): """Wait for this server to come up""" if http: - yield wait_for_http_server(self.url, timeout=timeout) + return wait_for_http_server(self.url, timeout=timeout) else: - yield wait_for_server(self._connect_ip, self.port, timeout=timeout) + return wait_for_server(self._connect_ip, self.port, timeout=timeout) def is_up(self): """Is the server accepting connections?""" diff --git a/jupyterhub/utils.py b/jupyterhub/utils.py index 869cc0d1..1ac76a2e 100644 --- a/jupyterhub/utils.py +++ b/jupyterhub/utils.py @@ -89,13 +89,13 @@ def wait_for_http_server(url, timeout=10): yield gen.sleep(0.1) else: app_log.debug("Server at %s responded with %s", url, e.code) - return + return e.response except (OSError, socket.error) as e: if e.errno not in {errno.ECONNABORTED, errno.ECONNREFUSED, errno.ECONNRESET}: app_log.warning("Failed to connect to %s (%s)", url, e) yield gen.sleep(0.1) else: - return + return r raise TimeoutError( "Server at {url} didn't respond in {timeout} seconds".format(**locals())