From 4e3184eae9fb16b735248492d97492cc62345660 Mon Sep 17 00:00:00 2001 From: Hunter B Date: Sun, 7 Jun 2026 10:34:58 -0700 Subject: [PATCH] fix(client): consume probe response body to return connection to pool Harvested from PR #2884 by @ousamabenyounes. Drops the orphan desktop tray.rs module (dead code, never wired) from that PR. Co-Authored-By: Ben Younes <2910651+ousamabenyounes@users.noreply.github.com> --- crates/tui/src/client.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/tui/src/client.rs b/crates/tui/src/client.rs index 30c710f6..a0fa8ca6 100644 --- a/crates/tui/src/client.rs +++ b/crates/tui/src/client.rs @@ -930,7 +930,10 @@ impl DeepSeekClient { anyhow::bail!("Speech synthesis failed: HTTP {status}: {error_text}"); } - let response_text = response.text().await.unwrap_or_default(); + let response_text = response + .text() + .await + .context("Failed to read speech synthesis response body")?; let payload: Value = serde_json::from_str(&response_text) .context("Failed to parse speech synthesis response JSON")?; let (audio_bytes, transcript) = parse_speech_audio_response(&payload)?; @@ -982,6 +985,8 @@ impl DeepSeekClient { let probe = self.http_client.get(health_url).send().await; match probe { Ok(resp) if resp.status().is_success() => { + // Consume the response body so the connection can be returned to the pool. + let _ = resp.text().await; self.mark_request_success().await; logging::info("Recovery probe succeeded"); } @@ -1099,6 +1104,8 @@ impl LlmClient for DeepSeekClient { let response = self.http_client.get(health_url).send().await; match response { Ok(resp) if resp.status().is_success() => { + // Consume the response body so the connection can be returned to the pool. + let _ = resp.text().await; self.mark_request_success().await; Ok(true) } @@ -1438,7 +1445,10 @@ impl DeepSeekClient { ); anyhow::bail!("FIM API error: HTTP {status}: {error_text}"); } - let response_text = response.text().await.unwrap_or_default(); + let response_text = response + .text() + .await + .context("Failed to read FIM API response body")?; let value: serde_json::Value = serde_json::from_str(&response_text).context("Failed to parse FIM API response")?; let text = value