Skip to content

Commit 16b28e3

Browse files
Force close_session on ConnectionClosedOK
1 parent 3250828 commit 16b28e3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/replit_river/v2/session.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
)
2121

2222
import nanoid
23-
from websockets import ConnectionClosedOK
2423
import websockets.asyncio.client
2524
from aiochannel import Channel, ChannelEmpty, ChannelFull
2625
from aiochannel.errors import ChannelClosed
2726
from opentelemetry.trace import Span, use_span
2827
from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator
2928
from pydantic import ValidationError
29+
from websockets import ConnectionClosedOK
3030
from websockets.asyncio.client import ClientConnection
3131
from websockets.exceptions import ConnectionClosed
3232

@@ -1331,6 +1331,9 @@ async def _recv_from_ws(
13311331
# is no @overrides in `websockets` to hint this.
13321332
try:
13331333
message = await ws.recv(decode=False)
1334+
except ConnectionClosedOK as e:
1335+
close_session(e)
1336+
continue
13341337
except ConnectionClosed:
13351338
# This triggers a break in the inner loop so we can get back to
13361339
# the outer loop.

0 commit comments

Comments
 (0)