Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add block=True back to get_msg() #641

Merged
merged 1 commit into from Apr 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions jupyter_client/channels.py
Expand Up @@ -254,12 +254,17 @@ async def _recv(self, **kwargs) -> t.Dict[str, t.Any]:
ident, smsg = self.session.feed_identities(msg)
return self.session.deserialize(smsg)

async def get_msg(self, timeout: t.Optional[float] = None) -> t.Dict[str, t.Any]:
async def get_msg(
self, block: bool = True, timeout: t.Optional[float] = None
) -> t.Dict[str, t.Any]:
""" Gets a message if there is one that is ready. """
if timeout is not None:
timeout *= 1000 # seconds to ms
assert self.socket is not None
ready = await self.socket.poll(timeout)
if block:
if timeout is not None:
timeout *= 1000 # seconds to ms
ready = await self.socket.poll(timeout)
else:
ready = await self.socket.poll(0)

if ready:
res = await self._recv()
Expand Down