From 130bd0cded548838ee1a497ba335645a0adbbc1d Mon Sep 17 00:00:00 2001 From: Taylor Baldwin Date: Tue, 13 Jan 2026 15:02:41 +0000 Subject: [PATCH] stop sending messages on closed websockets --- common/src/typed_socket/server.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/src/typed_socket/server.rs b/common/src/typed_socket/server.rs index 33ffc58f..18f6349d 100644 --- a/common/src/typed_socket/server.rs +++ b/common/src/typed_socket/server.rs @@ -30,7 +30,10 @@ pub async fn handle_messages( SocketAction::Send(msg) => { let msg = Message::Text(serde_json::to_string(&msg).expect("Always serializable.")); if let Err(err) = socket.send(msg.clone()).await { - tracing::error!(?err, message=?msg, "Failed to send message on websocket."); + tracing::warn!(?err, ?msg, "Failed to send message on websocket."); + // If the connection is already closed, the error is unrecoverable, + // and we should stop trying to send messages. + break; } } SocketAction::Close => {