Fix slow.rs
This commit is contained in:
parent
4fbb3530ea
commit
e9617e7f80
2 changed files with 11 additions and 3 deletions
|
|
@ -37,7 +37,11 @@ impl<U: StorageFactory + Clone> StorageFactory for SlowStorageFactory<U> {
|
||||||
underlying: self.underlying_factory.init_storage(info)?,
|
underlying: self.underlying_factory.init_storage(info)?,
|
||||||
pwrite_all_bufread: Mutex::new(Box::new(
|
pwrite_all_bufread: Mutex::new(Box::new(
|
||||||
BufReader::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()
|
.lines()
|
||||||
.map(|l| l.unwrap().parse().unwrap())
|
.map(|l| l.unwrap().parse().unwrap())
|
||||||
|
|
@ -46,7 +50,11 @@ impl<U: StorageFactory + Clone> StorageFactory for SlowStorageFactory<U> {
|
||||||
)),
|
)),
|
||||||
pread_exact_bufread: Mutex::new(Box::new(
|
pread_exact_bufread: Mutex::new(Box::new(
|
||||||
BufReader::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()
|
.lines()
|
||||||
.map(|l| l.unwrap().parse().unwrap())
|
.map(|l| l.unwrap().parse().unwrap())
|
||||||
|
|
|
||||||
|
|
@ -303,7 +303,7 @@ async fn async_main(opts: Opts) -> anyhow::Result<()> {
|
||||||
fn wrap<S: StorageFactory + Clone>(s: S) -> impl StorageFactory {
|
fn wrap<S: StorageFactory + Clone>(s: S) -> impl StorageFactory {
|
||||||
#[cfg(feature = "debug_slow_disk")]
|
#[cfg(feature = "debug_slow_disk")]
|
||||||
{
|
{
|
||||||
use librqbit::middleware::{
|
use librqbit::storage::middleware::{
|
||||||
slow::SlowStorageFactory, timing::TimingStorageFactory,
|
slow::SlowStorageFactory, timing::TimingStorageFactory,
|
||||||
};
|
};
|
||||||
TimingStorageFactory::new("hdd".to_owned(), SlowStorageFactory::new(s))
|
TimingStorageFactory::new("hdd".to_owned(), SlowStorageFactory::new(s))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue