From 338c74de694bab52872ca3e4f39ea0cb859d3610 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Sat, 2 May 2026 16:12:42 +0000 Subject: [PATCH] Avoid noisy output on normal WebSocket closing. --- cista/util/apphelpers.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cista/util/apphelpers.py b/cista/util/apphelpers.py index ab91626..e6303a8 100644 --- a/cista/util/apphelpers.py +++ b/cista/util/apphelpers.py @@ -2,6 +2,7 @@ import time from functools import wraps import msgspec +import websockets.exceptions from sanic import errorpages from sanic.exceptions import SanicException from sanic.log import logger @@ -67,6 +68,12 @@ def websocket_wrapper(handler): try: await auth.verify(request) await handler(request, ws, *args, **kwargs) + except ( + websockets.exceptions.ConnectionClosedOK, + websockets.exceptions.ConnectionClosedError, + ): + # Normal websocket closure - already logged in access log + pass except Exception as e: context, code, message = {}, 500, str(e) or "Internal Server Error" if isinstance(e, SanicException):