mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-11 20:13:02 +00:00
consistent handling of any timeout error
some things raise standard TimeoutError, others may raise tornado gen.TimeoutError (gen.with_timeout) For consistency, add AnyTimeoutError tuple to allow catching any timeout, no matter what kind Where we were raising `TimeoutError`, we should have been raising `asyncio.TimeoutError`. The base TimeoutError is an OSError for ETIMEO, which is for system calls
This commit is contained in:
@@ -26,6 +26,7 @@ from .metrics import RUNNING_SERVERS
|
||||
from .metrics import TOTAL_USERS
|
||||
from .objects import Server
|
||||
from .spawner import LocalProcessSpawner
|
||||
from .utils import AnyTimeoutError
|
||||
from .utils import make_ssl_context
|
||||
from .utils import maybe_future
|
||||
from .utils import url_path_join
|
||||
@@ -707,7 +708,7 @@ class User:
|
||||
db.commit()
|
||||
|
||||
except Exception as e:
|
||||
if isinstance(e, gen.TimeoutError):
|
||||
if isinstance(e, AnyTimeoutError):
|
||||
self.log.warning(
|
||||
"{user}'s server failed to start in {s} seconds, giving up".format(
|
||||
user=self.name, s=spawner.start_timeout
|
||||
@@ -764,7 +765,7 @@ class User:
|
||||
http=True, timeout=spawner.http_timeout, ssl_context=ssl_context
|
||||
)
|
||||
except Exception as e:
|
||||
if isinstance(e, TimeoutError):
|
||||
if isinstance(e, AnyTimeoutError):
|
||||
self.log.warning(
|
||||
"{user}'s server never showed up at {url} "
|
||||
"after {http_timeout} seconds. Giving up".format(
|
||||
|
Reference in New Issue
Block a user