Skip to content

Commit e0776de

Browse files
Handshake deadline should have been established prior to the loop
1 parent 9deaab1 commit e0776de

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/replit_river/v2/session.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,11 @@ async def _do_ensure_connected[HandshakeMetadata](
10851085

10861086
last_error: Exception | None = None
10871087
attempt_count = 0
1088+
1089+
handshake_deadline_ms = (
1090+
get_current_time() + transport_options.handshake_timeout_ms / 1000
1091+
)
1092+
10881093
while rate_limiter.has_budget(client_id):
10891094
if (state := get_state()) in TerminalStates or state in ActiveStates:
10901095
logger.info(f"_do_ensure_connected stopping due to state={state}")
@@ -1143,10 +1148,6 @@ async def websocket_closed_callback() -> None:
11431148
"Handshake failed, conn closed while sending response",
11441149
) from e
11451150

1146-
handshake_deadline_ms = (
1147-
get_current_time() + transport_options.handshake_timeout_ms
1148-
)
1149-
11501151
if get_current_time() >= handshake_deadline_ms:
11511152
raise RiverException(
11521153
ERROR_HANDSHAKE,

0 commit comments

Comments
 (0)