Skip to content
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

Avoid showing "No answer for 5s" when shutdown is slow #1320

Merged
merged 1 commit into from
Sep 4, 2023
Merged
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: 7 additions & 0 deletions jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ class ServerApp(JupyterApp):
)

_log_formatter_cls = LogFormatter # type:ignore[assignment]
_stopping = Bool(False, help="Signal that we've begun stopping.")

@default("log_level")
def _default_log_level(self):
Expand Down Expand Up @@ -2264,6 +2265,10 @@ def _confirm_exit(self):
self.stop(from_signal=True)
return
else:
if self._stopping:
# don't show 'no answer' if we're actually stopping,
# e.g. ctrl-C ctrl-C
return
info(_i18n("No answer for 5s:"))
info(_i18n("resuming operation..."))
# no answer, or answer is no:
Expand Down Expand Up @@ -2960,6 +2965,8 @@ async def _stop(self):

def stop(self, from_signal=False):
"""Cleanup resources and stop the server."""
# signal that stopping has begun
self._stopping = True
if hasattr(self, "http_server"):
# Stop a server if its set.
self.http_server.stop()
Expand Down
Loading