Warn ConnectionClosedError in websocket/streaming (#3760)

This commit is contained in:
Stanislav Novosad
2025-10-17 18:29:13 -06:00
committed by GitHub
parent 2843528a9c
commit 441f46ab5c

View File

@@ -5,7 +5,7 @@ from datetime import datetime
import structlog import structlog
from fastapi import WebSocket, WebSocketDisconnect from fastapi import WebSocket, WebSocketDisconnect
from pydantic import ValidationError from pydantic import ValidationError
from websockets.exceptions import ConnectionClosedOK from websockets.exceptions import ConnectionClosedError, ConnectionClosedOK
from skyvern.forge import app from skyvern.forge import app
from skyvern.forge.sdk.routes.routers import legacy_base_router from skyvern.forge.sdk.routes.routers import legacy_base_router
@@ -112,6 +112,13 @@ async def task_stream(
except ConnectionClosedOK: except ConnectionClosedOK:
LOG.info("ConnectionClosedOK error while streaming", task_id=task_id, organization_id=organization_id) LOG.info("ConnectionClosedOK error while streaming", task_id=task_id, organization_id=organization_id)
return return
except ConnectionClosedError:
LOG.warning(
"ConnectionClosedError while streaming (client likely disconnected)",
task_id=task_id,
organization_id=organization_id,
)
return
except Exception: except Exception:
LOG.warning("Error while streaming", task_id=task_id, organization_id=organization_id, exc_info=True) LOG.warning("Error while streaming", task_id=task_id, organization_id=organization_id, exc_info=True)
return return
@@ -237,6 +244,13 @@ async def workflow_run_streaming(
organization_id=organization_id, organization_id=organization_id,
) )
return return
except ConnectionClosedError:
LOG.warning(
"WofklowRun Streaming: ConnectionClosedError while streaming (client likely disconnected)",
workflow_run_id=workflow_run_id,
organization_id=organization_id,
)
return
except Exception: except Exception:
LOG.warning( LOG.warning(
"WofklowRun Streaming: Error while streaming", "WofklowRun Streaming: Error while streaming",