From e9617e7f8036e4114de9174da32f4c1cfa93590e Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Fri, 3 May 2024 13:52:33 +0100 Subject: [PATCH] Fix slow.rs --- crates/librqbit/src/storage/middleware/slow.rs | 12 ++++++++++-- crates/rqbit/src/main.rs | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/librqbit/src/storage/middleware/slow.rs b/crates/librqbit/src/storage/middleware/slow.rs index 06c6754..ad01e69 100644 --- a/crates/librqbit/src/storage/middleware/slow.rs +++ b/crates/librqbit/src/storage/middleware/slow.rs @@ -37,7 +37,11 @@ impl StorageFactory for SlowStorageFactory { underlying: self.underlying_factory.init_storage(info)?, pwrite_all_bufread: Mutex::new(Box::new( BufReader::new( - File::open(std::env::var("DBG_PWRITE_ALL_FILENAME").unwrap()).unwrap(), + File::open( + std::env::var("DBG_PWRITE_ALL_FILENAME") + .expect("DBG_PWRITE_ALL_FILENAME env var not there"), + ) + .unwrap(), ) .lines() .map(|l| l.unwrap().parse().unwrap()) @@ -46,7 +50,11 @@ impl StorageFactory for SlowStorageFactory { )), pread_exact_bufread: Mutex::new(Box::new( BufReader::new( - File::open(std::env::var("DBG_PWRITE_ALL_FILENAME").unwrap()).unwrap(), + File::open( + std::env::var("DBG_PWRITE_ALL_FILENAME") + .expect("DBG_PWRITE_ALL_FILENAME env var not there"), + ) + .unwrap(), ) .lines() .map(|l| l.unwrap().parse().unwrap()) diff --git a/crates/rqbit/src/main.rs b/crates/rqbit/src/main.rs index 794cc36..e11602f 100644 --- a/crates/rqbit/src/main.rs +++ b/crates/rqbit/src/main.rs @@ -303,7 +303,7 @@ async fn async_main(opts: Opts) -> anyhow::Result<()> { fn wrap(s: S) -> impl StorageFactory { #[cfg(feature = "debug_slow_disk")] { - use librqbit::middleware::{ + use librqbit::storage::middleware::{ slow::SlowStorageFactory, timing::TimingStorageFactory, }; TimingStorageFactory::new("hdd".to_owned(), SlowStorageFactory::new(s))