File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
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
+ import asyncio
9
9
import time
10
10
import warnings
11
11
@@ -34,11 +34,8 @@ def _loop_default(self):
34
34
def start (self ):
35
35
"""Start the polling of the kernel."""
36
36
if self ._pcallback is None :
37
- if inspect .isawaitable (self .poll ):
38
-
39
- def cb ():
40
- run_sync (self .poll )
41
-
37
+ if asyncio .iscoroutinefunction (self .poll ):
38
+ cb = run_sync (self .poll )
42
39
else :
43
40
cb = self .poll
44
41
self ._pcallback = ioloop .PeriodicCallback (
@@ -97,8 +94,8 @@ async def poll(self):
97
94
stable_start_time = self .kernel_manager .provisioner .get_stable_start_time (
98
95
recommended = stable_start_time
99
96
)
100
- if self ._initial_startup and self . _last_dead - now >= stable_start_time :
97
+ if self ._initial_startup and now - self . _last_dead >= stable_start_time :
101
98
self ._initial_startup = False
102
- if self ._restarting and self . _last_dead - now >= stable_start_time :
99
+ if self ._restarting and now - self . _last_dead >= stable_start_time :
103
100
self .log .debug ("AsyncIOLoopKernelRestarter: restart apparently succeeded" )
104
101
self ._restarting = False
Original file line number Diff line number Diff line change @@ -155,8 +155,8 @@ def poll(self):
155
155
stable_start_time = self .kernel_manager .provisioner .get_stable_start_time (
156
156
recommended = stable_start_time
157
157
)
158
- if self ._initial_startup and self . _last_dead - now >= stable_start_time :
158
+ if self ._initial_startup and now - self . _last_dead >= stable_start_time :
159
159
self ._initial_startup = False
160
- if self ._restarting and self . _last_dead - now >= stable_start_time :
160
+ if self ._restarting and now - self . _last_dead >= stable_start_time :
161
161
self .log .debug ("KernelRestarter: restart apparently succeeded" )
162
162
self ._restarting = False
You can’t perform that action at this time.
0 commit comments