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