Skip to content

initialize ioloop earlier #934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2341,7 +2341,8 @@ def init_httpserver(self):
max_buffer_size=self.max_buffer_size,
)

success = self._bind_http_server()
# binding sockets must be called from inside an event loop
success = self.io_loop.run_sync(self._bind_http_server)
if not success:
self.log.critical(
_i18n(
Expand Down Expand Up @@ -2482,6 +2483,9 @@ def initialize(
self._preferred_dir_validation(self.preferred_dir, self.root_dir)
if self._dispatching:
return
# initialize io loop as early as possible,
# so configurables, extensions may reference the event loop
self.init_ioloop()
# Then, use extensions' config loading mechanism to
# update config. ServerApp config takes precedence.
if find_extensions:
Expand All @@ -2507,7 +2511,6 @@ def initialize(
self.init_components()
self.init_webapp()
self.init_signal()
self.init_ioloop()
self.load_server_extensions()
self.init_mime_overrides()
self.init_shutdown_no_activity()
Expand Down