Skip to content

Commit

Permalink
Merge pull request #286 from blink1073/fix-handle_external_iopub-again
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Mar 3, 2023
2 parents 4c5bcf8 + 86412a4 commit 2c444cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions jupyter_console/ptshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
from pygments.util import ClassNotFound
from pygments.token import Token

from jupyter_console.utils import run_sync
from jupyter_console.utils import run_sync, ensure_async


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

def handle_iopub(self, msg_id=''):
"""Process messages on the IOPub channel
Expand Down
2 changes: 1 addition & 1 deletion jupyter_console/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import inspect
import typing as t
from jupyter_core.utils import run_sync as _run_sync
from jupyter_core.utils import run_sync as _run_sync, ensure_async # noqa


T = t.TypeVar("T")
Expand Down

0 comments on commit 2c444cb

Please sign in to comment.