_list_maybe_running_servers() finds 20 possible servers on my system when no notebook is running. This means that name() will run for around 20 seconds because every urllib.request.urlopen() call will only timeout after 1s.
I played around with sending a HEAD request first to test if the url is being served, but it seems like that's not an allowed method in this case.
So my suggestion would be to add an optional timeout argument to name() and path() which lets the user decide how long to wait for the timeout. Something on the order of 5 ms still worked reliably for me, but in the currently used 500 ms could be set as the default.
_list_maybe_running_servers()
finds 20 possible servers on my system when no notebook is running. This means thatname()
will run for around 20 seconds because everyurllib.request.urlopen()
call will only timeout after 1s.I played around with sending a
HEAD
request first to test if the url is being served, but it seems like that's not an allowed method in this case.So my suggestion would be to add an optional timeout argument to
name()
andpath()
which lets the user decide how long to wait for the timeout. Something on the order of 5 ms still worked reliably for me, but in the currently used 500 ms could be set as the default.