11import asyncio
22import logging
3+ import time
34from collections import deque
45from collections .abc import AsyncIterable
56from contextlib import asynccontextmanager
@@ -308,7 +309,7 @@ def unbind_connecting_task() -> None:
308309 uri_and_metadata_factory = self ._uri_and_metadata_factory ,
309310 get_next_sent_seq = get_next_sent_seq ,
310311 get_current_ack = lambda : self .ack ,
311- get_current_time = self . _get_current_time ,
312+ get_current_time = lambda : time . time () ,
312313 get_state = lambda : self ._state ,
313314 transition_connecting = transition_connecting ,
314315 close_ws_in_background = close_ws_in_background ,
@@ -334,9 +335,6 @@ def is_terminal(self) -> bool:
334335 def is_connected (self ) -> bool :
335336 return self ._state in ActiveStates
336337
337- async def _get_current_time (self ) -> float :
338- return asyncio .get_event_loop ().time ()
339-
340338 async def _enqueue_message (
341339 self ,
342340 stream_id : str ,
@@ -1073,7 +1071,7 @@ async def _do_ensure_connected[HandshakeMetadata](
10731071 uri_and_metadata_factory : Callable [
10741072 [], Awaitable [UriAndMetadata [HandshakeMetadata ]]
10751073 ],
1076- get_current_time : Callable [[], Awaitable [ float ] ],
1074+ get_current_time : Callable [[], float ],
10771075 get_next_sent_seq : Callable [[], int ],
10781076 get_current_ack : Callable [[], int ],
10791077 get_state : Callable [[], SessionState ],
@@ -1146,10 +1144,10 @@ async def websocket_closed_callback() -> None:
11461144 ) from e
11471145
11481146 handshake_deadline_ms = (
1149- await get_current_time () + transport_options .handshake_timeout_ms
1147+ get_current_time () + transport_options .handshake_timeout_ms
11501148 )
11511149
1152- if await get_current_time () >= handshake_deadline_ms :
1150+ if get_current_time () >= handshake_deadline_ms :
11531151 raise RiverException (
11541152 ERROR_HANDSHAKE ,
11551153 "Handshake response timeout, closing connection" ,
0 commit comments