From 6bc555adc9b790ddf132fe7fc3c8ac9ba6f4a72a Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Tue, 17 Feb 2026 13:41:43 -0800 Subject: [PATCH] fix --- codex-rs/codex-api/src/endpoint/realtime_websocket.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/codex-rs/codex-api/src/endpoint/realtime_websocket.rs b/codex-rs/codex-api/src/endpoint/realtime_websocket.rs index c72a9c4326..f56b204ec7 100644 --- a/codex-rs/codex-api/src/endpoint/realtime_websocket.rs +++ b/codex-rs/codex-api/src/endpoint/realtime_websocket.rs @@ -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(())