Skip to content

Commit 1d9a77a

Browse files
authored
Avoid showing "No answer for 5s" when shutdown is slow (#1320)
1 parent 93fde1a commit 1d9a77a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

jupyter_server/serverapp.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ class ServerApp(JupyterApp):
833833
)
834834

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

837838
@default("log_level")
838839
def _default_log_level(self):
@@ -2264,6 +2265,10 @@ def _confirm_exit(self):
22642265
self.stop(from_signal=True)
22652266
return
22662267
else:
2268+
if self._stopping:
2269+
# don't show 'no answer' if we're actually stopping,
2270+
# e.g. ctrl-C ctrl-C
2271+
return
22672272
info(_i18n("No answer for 5s:"))
22682273
info(_i18n("resuming operation..."))
22692274
# no answer, or answer is no:
@@ -2960,6 +2965,8 @@ async def _stop(self):
29602965

29612966
def stop(self, from_signal=False):
29622967
"""Cleanup resources and stop the server."""
2968+
# signal that stopping has begun
2969+
self._stopping = True
29632970
if hasattr(self, "http_server"):
29642971
# Stop a server if its set.
29652972
self.http_server.stop()

0 commit comments

Comments
 (0)