Skip to content

Commit

Permalink
change yroom class attribute to instance attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Jialin Zhang committed May 3, 2024
1 parent 1cd727f commit a993c27
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pycrdt_websocket/yroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ class YRoom:
_on_message: Callable[[bytes], Awaitable[bool] | bool] | None
_update_send_stream: MemoryObjectSendStream
_update_receive_stream: MemoryObjectReceiveStream
_task_group: TaskGroup | None = None
_started: Event | None = None
_task_group: TaskGroup | None
_started: Event | None
_stopped: Event
__start_lock: Lock | None = None
_subscription: Subscription | None = None

__start_lock: Lock | None
_subscription: Subscription | None
def __init__(
self,
ready: bool = True,
Expand Down Expand Up @@ -82,6 +82,10 @@ def __init__(
self._on_message = None
self.exception_handler = exception_handler
self._stopped = Event()
self._task_group = None
self._started = None
self.__start_lock = None
self._subscription = None

@property
def _start_lock(self) -> Lock:
Expand Down Expand Up @@ -230,6 +234,7 @@ async def stop(self) -> None:
self._stopped.set()
self._task_group.cancel_scope.cancel()
self._task_group = None
await self.ystore.stop()
if self._subscription is not None:
self.ydoc.unobserve(self._subscription)

Expand Down

0 comments on commit a993c27

Please sign in to comment.