fix: remove unused imports and fix type mismatches
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -7,7 +7,6 @@ use std::io::Read;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use tokio_util::io::ReaderStream;
|
|
||||||
|
|
||||||
/// An asynchronous wrapper around the `ItemService` for use in async contexts like the web server.
|
/// An asynchronous wrapper around the `ItemService` for use in async contexts like the web server.
|
||||||
/// It uses `tokio::task::spawn_blocking` to run synchronous database and filesystem operations
|
/// It uses `tokio::task::spawn_blocking` to run synchronous database and filesystem operations
|
||||||
@@ -212,7 +211,6 @@ impl AsyncItemService {
|
|||||||
// Since ReaderStream requires AsyncRead, we'll create our own implementation
|
// Since ReaderStream requires AsyncRead, we'll create our own implementation
|
||||||
use tokio_stream::StreamExt;
|
use tokio_stream::StreamExt;
|
||||||
use tokio_util::bytes::Bytes;
|
use tokio_util::bytes::Bytes;
|
||||||
use std::io::Error;
|
|
||||||
|
|
||||||
// Create a channel to stream data between the blocking thread and async runtime
|
// Create a channel to stream data between the blocking thread and async runtime
|
||||||
let (tx, rx) = tokio::sync::mpsc::channel(1);
|
let (tx, rx) = tokio::sync::mpsc::channel(1);
|
||||||
@@ -247,12 +245,12 @@ impl AsyncItemService {
|
|||||||
let mut bytes_sent = 0;
|
let mut bytes_sent = 0;
|
||||||
Box::pin(stream.take_while(move |result| {
|
Box::pin(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
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
Box::pin(stream)
|
Box::pin(stream)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ 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)))?;
|
||||||
Ok(reader)
|
Ok(Box::new(reader))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user