diff --git a/src/services/async_item_service.rs b/src/services/async_item_service.rs index 7fb593f..33bce7d 100644 --- a/src/services/async_item_service.rs +++ b/src/services/async_item_service.rs @@ -7,7 +7,6 @@ use std::io::Read; use std::path::PathBuf; use std::sync::Arc; use tokio::sync::Mutex; -use tokio_util::io::ReaderStream; /// 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 @@ -212,7 +211,6 @@ impl AsyncItemService { // Since ReaderStream requires AsyncRead, we'll create our own implementation use tokio_stream::StreamExt; use tokio_util::bytes::Bytes; - use std::io::Error; // Create a channel to stream data between the blocking thread and async runtime let (tx, rx) = tokio::sync::mpsc::channel(1); @@ -247,12 +245,12 @@ impl AsyncItemService { let mut bytes_sent = 0; Box::pin(stream.take_while(move |result| { if bytes_sent >= length { - return std::future::ready(false); + return false; } if let Ok(chunk) = result { bytes_sent += chunk.len() as u64; } - std::future::ready(true) + true })) } else { Box::pin(stream) diff --git a/src/services/compression_service.rs b/src/services/compression_service.rs index ddfa328..3a31b3e 100644 --- a/src/services/compression_service.rs +++ b/src/services/compression_service.rs @@ -37,7 +37,7 @@ impl CompressionService { let reader = engine.open(item_path.clone()) .map_err(|e| CoreError::Other(anyhow!("Failed to open item file {:?}: {}", item_path, e)))?; - Ok(reader) + Ok(Box::new(reader)) } }