File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
jupyter_server/services/kernels/connection Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments