@@ -1086,13 +1086,12 @@ async def _do_ensure_connected[HandshakeMetadata](
1086
1086
last_error : Exception | None = None
1087
1087
attempt_count = 0
1088
1088
1089
- handshake_deadline_ms = (
1089
+ handshake_deadline = (
1090
1090
get_current_time () + transport_options .handshake_timeout_ms / 1000
1091
1091
)
1092
1092
1093
1093
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
1096
1095
):
1097
1096
if (state := get_state ()) in TerminalStates or state in ActiveStates :
1098
1097
logger .info (f"_do_ensure_connected stopping due to state={ state } " )
@@ -1154,14 +1153,14 @@ async def websocket_closed_callback() -> None:
1154
1153
"Handshake failed, conn closed while sending response" ,
1155
1154
) from e
1156
1155
1157
- if get_current_time () >= handshake_deadline_ms :
1156
+ if get_current_time () >= handshake_deadline :
1158
1157
raise RiverException (
1159
1158
ERROR_HANDSHAKE ,
1160
1159
"Handshake response timeout, closing connection" ,
1161
1160
)
1162
1161
1163
1162
try :
1164
- timeout = handshake_deadline_ms - get_current_time () / 1000.0
1163
+ timeout = handshake_deadline - get_current_time ()
1165
1164
async with asyncio .timeout (timeout ):
1166
1165
data = await ws .recv (decode = False )
1167
1166
except ConnectionClosedOK :
@@ -1237,15 +1236,15 @@ async def websocket_closed_callback() -> None:
1237
1236
transition_connected (ws )
1238
1237
break
1239
1238
except Exception as e :
1240
- backoff_time = rate_limiter .get_backoff_ms (client_id )
1239
+ backoff_time_ms = rate_limiter .get_backoff_ms (client_id )
1241
1240
logger .exception (
1242
- f"Error connecting, retrying with { backoff_time } ms backoff"
1241
+ f"Error connecting, retrying with { backoff_time_ms } ms backoff"
1243
1242
)
1244
1243
if ws :
1245
1244
close_ws_in_background (ws )
1246
1245
ws = None
1247
1246
last_error = e
1248
- await asyncio .sleep (backoff_time / 1000 )
1247
+ await asyncio .sleep (backoff_time_ms / 1000 )
1249
1248
logger .debug ("Here, about to retry" )
1250
1249
unbind_connecting_task ()
1251
1250
0 commit comments