diff --git a/projects/jupyter-server-ydoc/jupyter_server_ydoc/handlers.py b/projects/jupyter-server-ydoc/jupyter_server_ydoc/handlers.py index 59849058..d74bd6df 100644 --- a/projects/jupyter-server-ydoc/jupyter_server_ydoc/handlers.py +++ b/projects/jupyter-server-ydoc/jupyter_server_ydoc/handlers.py @@ -341,7 +341,7 @@ async def _clean_room(self) -> None: async with self._room_lock(self._room_id): # Remove the room from the websocket server self.log.info("Deleting Y document from memory: %s", self._room_id) - self._websocket_server.delete_room(room=self.room) + await self._websocket_server.delete_room(room=self.room) # Clean room del self.room diff --git a/projects/jupyter-server-ydoc/jupyter_server_ydoc/rooms.py b/projects/jupyter-server-ydoc/jupyter_server_ydoc/rooms.py index e88e6d39..691943c5 100644 --- a/projects/jupyter-server-ydoc/jupyter_server_ydoc/rooms.py +++ b/projects/jupyter-server-ydoc/jupyter_server_ydoc/rooms.py @@ -155,13 +155,13 @@ def _emit(self, level: LogLevel, action: str | None = None, msg: str | None = No self._logger.emit(schema_id=JUPYTER_COLLABORATION_EVENTS_URI, data=data) - def stop(self) -> None: + async def stop(self) -> None: """ Stop the room. Cancels the save task and unsubscribes from the file. """ - super().stop() + await super().stop() # TODO: Should we cancel or wait ? if self._saving_document: self._saving_document.cancel() diff --git a/projects/jupyter-server-ydoc/jupyter_server_ydoc/websocketserver.py b/projects/jupyter-server-ydoc/jupyter_server_ydoc/websocketserver.py index 00d3f54e..365da078 100644 --- a/projects/jupyter-server-ydoc/jupyter_server_ydoc/websocketserver.py +++ b/projects/jupyter-server-ydoc/jupyter_server_ydoc/websocketserver.py @@ -58,7 +58,7 @@ async def clean(self): # self.log.warning(msg) # self.log.debug("Pending tasks: %r", pending) - self.stop() + await self.stop() tasks = [] if self.monitor_task is not None: self.monitor_task.cancel() diff --git a/projects/jupyter-server-ydoc/pyproject.toml b/projects/jupyter-server-ydoc/pyproject.toml index 30859d6a..9ab08633 100644 --- a/projects/jupyter-server-ydoc/pyproject.toml +++ b/projects/jupyter-server-ydoc/pyproject.toml @@ -30,7 +30,7 @@ authors = [ dependencies = [ "jupyter_server>=2.4.0,<3.0.0", "jupyter_ydoc>=2.0.0,<3.0.0", - "pycrdt-websocket>=0.12.5,<0.13.0", + "pycrdt-websocket>=0.13.0,<0.14.0", "jupyter_events>=0.10.0", "jupyter_server_fileid>=0.7.0,<1", "jsonschema>=4.18.0"