File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1090,11 +1090,17 @@ async def _do_ensure_connected[HandshakeMetadata](
10901090 get_current_time () + transport_options .handshake_timeout_ms / 1000
10911091 )
10921092
1093- while rate_limiter .has_budget (client_id ):
1093+ while (
1094+ rate_limiter .has_budget (client_id )
1095+ and get_current_time () < handshake_deadline_ms
1096+ ):
10941097 if (state := get_state ()) in TerminalStates or state in ActiveStates :
10951098 logger .info (f"_do_ensure_connected stopping due to state={ state } " )
10961099 break
10971100
1101+ if (task := asyncio .current_task ()) and task .cancelled ():
1102+ break
1103+
10981104 if attempt_count > 0 :
10991105 logger .info (f"Retrying build handshake number { attempt_count } times" )
11001106 attempt_count += 1
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ def trigger_close(
5555 nonlocal ws_close
5656
5757 closing_event = asyncio .Event ()
58+
5859 async def _do_close () -> None :
5960 signal_closing ()
6061 await task_manager .cancel_all_tasks ()
@@ -64,6 +65,7 @@ async def _do_close() -> None:
6465 await ws .close ()
6566 become_closed ()
6667 closing_event .set ()
68+
6769 ws_close = asyncio .create_task (_do_close ())
6870
6971 return closing_event
You can’t perform that action at this time.
0 commit comments