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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user