-
Notifications
You must be signed in to change notification settings - Fork 17
RuntimeError: Already mutably borrowed #79
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
I have a pycrdt.Doc that I make available to clients through a pycrdt_websocket.WebsocketServer. It's contained in a YRoom.
I want to react to changes in this doc on the server side too. I use observe() to be notified of the changes. Upon a change I want to access the contents of the Doc. But this fails:
File "python3.12/site-packages/pycrdt/_doc.py", line 198, in __getitem__
return self._roots[key]
^^^^^^^^^^^
File "python3.12/site-packages/pycrdt/_doc.py", line 246, in _roots
with self.transaction() as txn:
File "python3.12/site-packages/pycrdt/_transaction.py", line 61, in __enter__
self._txn = self._doc._doc.create_transaction()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Already mutably borrowed
What am I doing wrong? Does the YRoom have exclusive access to the Doc?
Reproduce
I can try to make an isolated repro if necessary.
Expected behavior
I was hoping I could access the data in the Doc from the observe() event handler.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working