fix: resolve type mismatches in async_item_service and compression_service

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-25 21:14:58 -03:00
parent f3132ec569
commit bfeba4151e
2 changed files with 9 additions and 7 deletions

View File

@@ -245,12 +245,12 @@ impl AsyncItemService {
let mut bytes_sent = 0; let mut bytes_sent = 0;
let limited = stream.take_while(move |result| { let limited = stream.take_while(move |result| {
if bytes_sent >= length { if bytes_sent >= length {
return std::future::ready(false); return false;
} }
if let Ok(chunk) = result { if let Ok(chunk) = result {
bytes_sent += chunk.len() as u64; bytes_sent += chunk.len() as u64;
} }
std::future::ready(true) true
}); });
Box::pin(limited) Box::pin(limited)
} else { } else {

View File

@@ -37,11 +37,13 @@ impl CompressionService {
let reader = engine.open(item_path.clone()) let reader = engine.open(item_path.clone())
.map_err(|e| CoreError::Other(anyhow!("Failed to open item file {:?}: {}", item_path, e)))?; .map_err(|e| CoreError::Other(anyhow!("Failed to open item file {:?}: {}", item_path, e)))?;
// Ensure the reader is Send by wrapping it if necessary // Since we can't guarantee the reader implements Send, we need to wrap it
// Since the reader is already a Box<dyn Read>, and we need Box<dyn Read + Send> // We'll read the content into a buffer and return a Cursor which is Send
// We can use a type assertion to ensure it's Send // This is not ideal for large files, but it ensures Send is implemented
// Most compression engines should return Send readers let mut content = Vec::new();
Ok(reader) let mut temp_reader = reader;
temp_reader.read_to_end(&mut content)?;
Ok(Box::new(std::io::Cursor::new(content)))
} }
} }