Skip to content

Commit b1e42bd

Browse files
committed
defer ready_event until connecting
1 parent 6485ab6 commit b1e42bd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/textual_dev/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ def __init__(self, host: str = "127.0.0.1", port: int | None = None) -> None:
103103
self.log_queue: Queue[str | bytes | Type[ClientShutdown]] | None = None
104104
self.spillover: int = 0
105105
self.verbose: bool = False
106-
self._ready_event: asyncio.Event = asyncio.Event()
107106

108107
async def connect(self) -> None:
109108
"""Connect to the devtools server.
@@ -124,6 +123,7 @@ async def connect(self) -> None:
124123

125124
log_queue = self.log_queue
126125
websocket = self.websocket
126+
ready_event = asyncio.Event()
127127

128128
async def update_console() -> None:
129129
"""Coroutine function scheduled as a Task, which listens on
@@ -141,7 +141,7 @@ async def update_console() -> None:
141141
self.console.width = payload["width"]
142142
self.console.height = payload["height"]
143143
self.verbose = payload.get("verbose", False)
144-
self._ready_event.set()
144+
ready_event.set()
145145

146146
async def send_queued_logs():
147147
"""Coroutine function which is scheduled as a Task, which consumes
@@ -162,7 +162,7 @@ async def send_queued_logs():
162162
async def server_info_received() -> None:
163163
"""Wait for the first server info message to be received and handled."""
164164
try:
165-
await asyncio.wait_for(self._ready_event.wait(), timeout=READY_TIMEOUT)
165+
await asyncio.wait_for(ready_event.wait(), timeout=READY_TIMEOUT)
166166
except asyncio.TimeoutError:
167167
return
168168

0 commit comments

Comments
 (0)