This commit is contained in:
Ahmed Ibrahim
2026-02-17 13:41:43 -08:00
parent b79bfc3a50
commit 6bc555adc9

View File

@@ -344,12 +344,10 @@ impl RealtimeWebsocketConnection {
let Some(ws) = guard.as_ref() else {
return Ok(());
};
if let Err(err) = ws.close().await {
if !matches!(err, WsError::ConnectionClosed | WsError::AlreadyClosed) {
return Err(ApiError::Stream(format!(
"failed to close websocket: {err}"
)));
}
if let Err(err) = ws.close().await
&& !matches!(err, WsError::ConnectionClosed | WsError::AlreadyClosed)
{
return Err(ApiError::Stream(format!("failed to close websocket: {err}")));
}
*guard = None;
Ok(())