Skip to content

Stop all channels to allow ZMQContext to properly cleanup between calls #183

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

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions jupyter_resource_usage/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,13 @@ async def get(self, matched_part=None, *args, **kwargs):
timeout_ms = 10_000
events = dict(await poller.poll(timeout_ms))
if control_socket not in events:
self.write(
json.dumps(
{
"content": {"reason": "timeout", "timeout_ms": timeout_ms},
"kernel_id": kernel_id,
}
)
out = json.dumps(
{
"content": {"reason": "timeout", "timeout_ms": timeout_ms},
"kernel_id": kernel_id,
}
)

else:
res = client.control_channel.get_msg(timeout=0)
if isawaitable(res):
Expand All @@ -138,4 +137,6 @@ async def get(self, matched_part=None, *args, **kwargs):
res = await res
if res:
res["kernel_id"] = kernel_id
self.write(json.dumps(res, default=date_default))
out = json.dumps(res, default=date_default)
client.stop_channels()
self.write(out)