Skip to content

Commit 434a241

Browse files
Wake up tasks pending connected state so they can exit cleanly
1 parent a894083 commit 434a241

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/replit_river/v2/session.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,13 @@ async def close(self) -> None:
473473
# already closing
474474
return
475475
self._state = SessionState.CLOSING
476+
477+
# We need to wake up all tasks waiting for connection to be established
478+
assert not self._connection_condition.locked()
479+
await self._connection_condition.acquire()
480+
self._connection_condition.notify_all()
481+
self._connection_condition.release()
482+
476483
await self._task_manager.cancel_all_tasks()
477484

478485
# TODO: unexpected_close should close stream differently here to

0 commit comments

Comments
 (0)