Bind the HTTPServer in start (#6061)

Binding sockets hooks them up to the running eventloop, which we should try to avoid in initialize
in case any other stages may configure the event loop policy
pull/6083/head
Min RK 5 years ago committed by GitHub
parent c1101de779
commit 80eb286f31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1792,12 +1792,6 @@ class NotebookApp(JupyterApp):
max_body_size=self.max_body_size,
max_buffer_size=self.max_buffer_size)
success = self._bind_http_server()
if not success:
self.log.critical(_('ERROR: the notebook server could not be started because '
'no available port could be found.'))
self.exit(1)
def _bind_http_server(self):
return self._bind_http_server_unix() if self.sock else self._bind_http_server_tcp()
@ -2297,6 +2291,12 @@ class NotebookApp(JupyterApp):
self.log.critical(_("Running as root is not recommended. Use --allow-root to bypass."))
self.exit(1)
success = self._bind_http_server()
if not success:
self.log.critical(_('ERROR: the notebook server could not be started because '
'no available port could be found.'))
self.exit(1)
info = self.log.info
for line in self.notebook_info(kernel_count=False).split("\n"):
info(line)

Loading…
Cancel
Save