Skip to content

Commit 891284a

Browse files
committed
Add block=True back to get_msg()
1 parent 49ed032 commit 891284a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

jupyter_client/channels.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,17 @@ async def _recv(self, **kwargs) -> t.Dict[str, t.Any]:
254254
ident, smsg = self.session.feed_identities(msg)
255255
return self.session.deserialize(smsg)
256256

257-
async def get_msg(self, timeout: t.Optional[float] = None) -> t.Dict[str, t.Any]:
257+
async def get_msg(
258+
self, block: bool = True, timeout: t.Optional[float] = None
259+
) -> t.Dict[str, t.Any]:
258260
""" Gets a message if there is one that is ready. """
259-
if timeout is not None:
260-
timeout *= 1000 # seconds to ms
261261
assert self.socket is not None
262-
ready = await self.socket.poll(timeout)
262+
if block:
263+
if timeout is not None:
264+
timeout *= 1000 # seconds to ms
265+
ready = await self.socket.poll(timeout)
266+
else:
267+
ready = await self.socket.poll(0)
263268

264269
if ready:
265270
res = await self._recv()

0 commit comments

Comments
 (0)