Skip to content

Commit 0468315

Browse files
committed
suppress cancelled errors in nudge
1 parent 4245014 commit 0468315

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

jupyter_server/services/kernels/connection/channels.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,16 @@ def nudge(count):
276276
nudge_handle = loop.call_later(0, nudge, count=0)
277277

278278
# resolve with a timeout if we get no response
279-
future = asyncio.ensure_future(asyncio.wait_for(all_done, timeout=self.kernel_info_timeout))
280-
# ensure we have no dangling resources or unresolved Futures in case of timeout
281-
future.add_done_callback(finish)
282-
return future
279+
def finish_nudge():
280+
try:
281+
await asyncio.wait_for(all_done, timeout=self.kernel_info_timeout)
282+
except asyncio.CancelledError:
283+
pass
284+
finally:
285+
# make sure everybody gets cancelled, just in case
286+
finish()
287+
288+
return asyncio.ensure_future(finish_nudge())
283289

284290
async def _register_session(self):
285291
"""Ensure we aren't creating a duplicate session.

0 commit comments

Comments
 (0)