Remove nested try block

This commit is contained in:
Shreerang Kale 2025-07-28 15:48:40 +05:30
parent 04b31f6a55
commit e44fa4f72b

View File

@ -31,17 +31,16 @@ class WebSocketProxy:
provider_ws, provider_session = provider_connection
try:
await asyncio.gather(
self._proxy_client_to_provider(ws, provider_ws, provider),
self._proxy_provider_to_client(provider_ws, ws, provider),
return_exceptions=True
)
finally:
# Clean up provider connection
if not provider_ws.closed:
await provider_ws.close()
await provider_session.close()
await asyncio.gather(
self._proxy_client_to_provider(ws, provider_ws, provider),
self._proxy_provider_to_client(provider_ws, ws, provider),
return_exceptions=True
)
# Clean up provider connection
if not provider_ws.closed:
await provider_ws.close()
await provider_session.close()
except Exception as e:
self.logger.error(f"WebSocket proxy error: {e}")