Skip to content

Commit 26fb61a

Browse files
wat
1 parent 6f78964 commit 26fb61a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/replit_river/v2/client_session.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,15 @@ async def _handle_messages_from_ws(self) -> None:
157157
try:
158158
ws = self._ws_unwrapped
159159
while True:
160+
if not self._ws_unwrapped:
161+
# We should not process messages if the websocket is closed.
162+
break
163+
160164
# decode=False: Avoiding an unnecessary round-trip through str
161165
# Ideally this should be type-ascripted to : bytes, but there is no
162166
# @overrides in `websockets` to hint this.
163167
message = await ws.recv(decode=False)
164168
try:
165-
if not self._ws_unwrapped:
166-
# We should not process messages if the websocket is closed.
167-
break
168169
msg = parse_transport_msg(message)
169170

170171
logger.debug(f"{self._transport_id} got a message %r", msg)

0 commit comments

Comments
 (0)