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

Switch to async for notebook client #26

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

fcollonval
Copy link
Member

The foundation of jupyter ydoc is built on top of pycrdt a thin wrapper of Yrs. Unfortunately that library is not thread safe. Therefore when implementing the logic for an agent reacting to document changes, we were facing lost of critical runtime error because the changes and the callback are not necessarily implemented in the same thread.

basically the document was exchanging with the peers through a websocket in a thread when the document itself and the callback on changes were handle in the main thread.

The best workaround while keeping Yrs is to move to an async approach to fake multi-threading. Hence this PR.

@fcollonval fcollonval marked this pull request as draft February 6, 2025 08:27
@fcollonval fcollonval added the enhancement New feature or request label Feb 6, 2025
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.

1 participant