Skip to content

Commit bf68171

Browse files
Disambiguating between seconds and milliseconds
1 parent 9fde4de commit bf68171

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/replit_river/v2/session.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,13 +1086,12 @@ async def _do_ensure_connected[HandshakeMetadata](
10861086
last_error: Exception | None = None
10871087
attempt_count = 0
10881088

1089-
handshake_deadline_ms = (
1089+
handshake_deadline = (
10901090
get_current_time() + transport_options.handshake_timeout_ms / 1000
10911091
)
10921092

10931093
while (
1094-
rate_limiter.has_budget(client_id)
1095-
and get_current_time() < handshake_deadline_ms
1094+
rate_limiter.has_budget(client_id) and get_current_time() < handshake_deadline
10961095
):
10971096
if (state := get_state()) in TerminalStates or state in ActiveStates:
10981097
logger.info(f"_do_ensure_connected stopping due to state={state}")
@@ -1154,14 +1153,14 @@ async def websocket_closed_callback() -> None:
11541153
"Handshake failed, conn closed while sending response",
11551154
) from e
11561155

1157-
if get_current_time() >= handshake_deadline_ms:
1156+
if get_current_time() >= handshake_deadline:
11581157
raise RiverException(
11591158
ERROR_HANDSHAKE,
11601159
"Handshake response timeout, closing connection",
11611160
)
11621161

11631162
try:
1164-
timeout = handshake_deadline_ms - get_current_time() / 1000.0
1163+
timeout = handshake_deadline - get_current_time()
11651164
async with asyncio.timeout(timeout):
11661165
data = await ws.recv(decode=False)
11671166
except ConnectionClosedOK:

0 commit comments

Comments
 (0)