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 a35810d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 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,7 +82,11 @@ 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:
if self.__start_lock is None:
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 a35810d

Please sign in to comment.