Skip to content

Commit a35810d

Browse files
author
Jialin Zhang
committed
change yroom class attribute to instance attribute
1 parent 1cd727f commit a35810d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

pycrdt_websocket/yroom.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ class YRoom:
3737
_on_message: Callable[[bytes], Awaitable[bool] | bool] | None
3838
_update_send_stream: MemoryObjectSendStream
3939
_update_receive_stream: MemoryObjectReceiveStream
40-
_task_group: TaskGroup | None = None
41-
_started: Event | None = None
40+
_task_group: TaskGroup | None
41+
_started: Event | None
4242
_stopped: Event
43-
__start_lock: Lock | None = None
44-
_subscription: Subscription | None = None
45-
43+
__start_lock: Lock | None
44+
_subscription: Subscription | None
45+
4646
def __init__(
4747
self,
4848
ready: bool = True,
@@ -82,7 +82,11 @@ def __init__(
8282
self._on_message = None
8383
self.exception_handler = exception_handler
8484
self._stopped = Event()
85-
85+
self._task_group = None
86+
self._started = None
87+
self.__start_lock = None
88+
self._subscription = None
89+
8690
@property
8791
def _start_lock(self) -> Lock:
8892
if self.__start_lock is None:
@@ -230,6 +234,7 @@ async def stop(self) -> None:
230234
self._stopped.set()
231235
self._task_group.cancel_scope.cancel()
232236
self._task_group = None
237+
await self.ystore.stop()
233238
if self._subscription is not None:
234239
self.ydoc.unobserve(self._subscription)
235240

0 commit comments

Comments
 (0)