Skip to content

Commit 2c444cb

Browse files
authored
Merge pull request #286 from blink1073/fix-handle_external_iopub-again
2 parents 4c5bcf8 + 86412a4 commit 2c444cb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

jupyter_console/ptshell.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
from pygments.util import ClassNotFound
7777
from pygments.token import Token
7878

79-
from jupyter_console.utils import run_sync
79+
from jupyter_console.utils import run_sync, ensure_async
8080

8181

8282
def ask_yes_no(prompt, default=None, interrupt=None):
@@ -839,9 +839,10 @@ def include_output(self, msg):
839839
async def handle_external_iopub(self, loop=None):
840840
while self.keep_running:
841841
# we need to check for keep_running from time to time
842-
poll_result = run_sync(self.client.iopub_channel.socket.poll)(500)
842+
poll_result = await ensure_async(self.client.iopub_channel.socket.poll(0))
843843
if poll_result:
844844
self.handle_iopub()
845+
await asyncio.sleep(0.5)
845846

846847
def handle_iopub(self, msg_id=''):
847848
"""Process messages on the IOPub channel

jupyter_console/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import inspect
22
import typing as t
3-
from jupyter_core.utils import run_sync as _run_sync
3+
from jupyter_core.utils import run_sync as _run_sync, ensure_async # noqa
44

55

66
T = t.TypeVar("T")

0 commit comments

Comments
 (0)