diff --git a/pycrdt_websocket/yroom.py b/pycrdt_websocket/yroom.py index ba4b654..6a9c2ec 100644 --- a/pycrdt_websocket/yroom.py +++ b/pycrdt_websocket/yroom.py @@ -213,6 +213,7 @@ async def start( self._task_group.start_soon(self._stopped.wait) self._task_group.start_soon(self._watch_ready) self._task_group.start_soon(self._broadcast_updates) + self._task_group.start_soon(self.awareness.start) return async with self._start_lock: @@ -231,8 +232,10 @@ async def start( self._task_group.start_soon(self._stopped.wait) self._task_group.start_soon(self._watch_ready) self._task_group.start_soon(self._broadcast_updates) + self._task_group.start_soon(self.awareness.start) return except Exception as exception: + await self.awareness.stop() self._handle_exception(exception) async def stop(self) -> None: @@ -240,6 +243,7 @@ async def stop(self) -> None: if self._task_group is None: raise RuntimeError("YRoom not running") self._stopped.set() + await self.awareness.stop() self._task_group.cancel_scope.cancel() self._task_group = None if self._subscription is not None: diff --git a/pyproject.toml b/pyproject.toml index b9685a0..02afbcf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ classifiers = [ dependencies = [ "anyio >=3.6.2,<5", "sqlite-anyio >=0.2.3,<0.3.0", - "pycrdt >=0.10.1,<0.11.0", + "pycrdt >=0.10.3,<0.11.0", ] [project.optional-dependencies]