Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

move websocket close to fix memory leak

Abi Raja0cc2c78f5528
diff --git a/backend/main.py b/backend/main.py
index d62e0b32..f91b25a0 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -202,5 +202,5 @@ async def stream_code(websocket: WebSocket):
await websocket.send_json(
{"type": "status", "value": "Image generation failed but code is complete."}
)
- finally:
- await websocket.close()
+
+ await websocket.close()