Skip to content

Use async tasks instead of blocking sync for store operations#338

Merged
manzt merged 1 commit intomainfrom
push-pltkmoovpymq
Mar 17, 2026
Merged

Use async tasks instead of blocking sync for store operations#338
manzt merged 1 commit intomainfrom
push-pltkmoovpymq

Conversation

@manzt
Copy link
Copy Markdown
Member

@manzt manzt commented Mar 17, 2026

The widget message handler was using zarr's _sync() to block the Jupyter kernel event loop while waiting on store reads. This freezes the kernel during slow operations like remote store access.

Since Jupyter already runs an asyncio event loop and zarr v3 stores expose a native async API, we can schedule store operations as async tasks directly via asyncio.create_task() rather than blocking. A _pending_tasks set prevents in-flight tasks from being garbage collected, following the same pattern used by lonboard.

The widget message handler was using zarr's `_sync()` to block the
Jupyter kernel event loop while waiting on store reads. This freezes the
kernel during slow operations like remote store access.

Since Jupyter already runs an asyncio event loop and zarr v3 stores
expose a native async API, we can schedule store operations as async
tasks directly via `asyncio.create_task()` rather than blocking. A
`_pending_tasks` set prevents in-flight tasks from being garbage
collected, following the same pattern used by lonboard.
@dbmi-svc-checkmarx
Copy link
Copy Markdown

Logo
Checkmarx One – Scan Summary & Details19b56784-f7fc-408f-ac02-e7b85216d498

Great job! No new security vulnerabilities introduced in this pull request


Use @Checkmarx to interact with Checkmarx PR Assistant.
Examples:
@Checkmarx how are you able to help me?
@Checkmarx rescan this PR

@manzt manzt added the enhancement New feature or request label Mar 17, 2026
@manzt manzt merged commit 82756a8 into main Mar 17, 2026
13 checks passed
@manzt manzt deleted the push-pltkmoovpymq branch March 17, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants