Skip to content

Commit 21e054e

Browse files
committed
fix: RegistryTEEConnection.reconnect() no longer swallows _connect() exceptions
1 parent 89e9d57 commit 21e054e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/opengradient/client/tee_connection.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,10 @@ def _connect(self) -> ActiveTEE:
153153
async def reconnect(self) -> None:
154154
"""Connect to a new TEE from the registry and rebuild the HTTP client."""
155155
async with self._refresh_lock:
156+
old_client = self._active.http_client
157+
self._active = self._connect()
156158
try:
157-
self._active = self._connect()
159+
await old_client.aclose()
158160
except Exception:
159161
logger.debug("Failed to close previous HTTP client during TEE refresh.", exc_info=True)
160162

@@ -198,3 +200,4 @@ async def close(self) -> None:
198200
self._refresh_task.cancel()
199201
self._refresh_task = None
200202
await self._active.http_client.aclose()
203+

0 commit comments

Comments
 (0)