File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 5
5
"""
6
6
# Copyright (c) Jupyter Development Team.
7
7
# Distributed under the terms of the Modified BSD License.
8
+ import inspect
8
9
import warnings
9
10
10
11
from traitlets import Instance
11
12
from zmq .eventloop import ioloop
12
13
13
14
from jupyter_client .restarter import KernelRestarter
15
+ from jupyter_client .utils import run_sync
14
16
15
17
16
18
class IOLoopKernelRestarter (KernelRestarter ):
@@ -31,8 +33,12 @@ def _loop_default(self):
31
33
def start (self ):
32
34
"""Start the polling of the kernel."""
33
35
if self ._pcallback is None :
36
+ if inspect .isawaitable (self .poll ):
37
+ cb = lambda : run_sync (self .poll )
38
+ else :
39
+ cb = self .poll
34
40
self ._pcallback = ioloop .PeriodicCallback (
35
- self . poll ,
41
+ cb ,
36
42
1000 * self .time_to_dead ,
37
43
)
38
44
self ._pcallback .start ()
You can’t perform that action at this time.
0 commit comments