It really helps to write to disk in a separate thread!

This commit is contained in:
Igor Katson 2024-05-01 23:01:06 +01:00
parent fa557cedd9
commit 9bcd18e7af
2 changed files with 4 additions and 2 deletions

View file

@ -42,7 +42,8 @@ fn random_duration() -> Duration {
// std::thread::sleep(sl) // std::thread::sleep(sl)
// //
let micros = 340f64 + sl * 200.; let micros = 340f64 + sl * 200.;
let micros = micros.max(0.001) * 4.; // 16 is max blocking threads
let micros = micros.max(0.001) * 4. * 16.;
Duration::from_micros(micros as u64) Duration::from_micros(micros as u64)
} }

View file

@ -1502,7 +1502,8 @@ impl PeerHandler {
let _ = tx.send(WriterRequest::Disconnect(Err(e))); let _ = tx.send(WriterRequest::Disconnect(Err(e)));
} }
}; };
disk_work_queue_tx.send(Box::new(work))?; tokio::runtime::Handle::current().spawn_blocking(work);
// disk_work_queue_tx.send(Box::new(work))?;
} else { } else {
self.state self.state
.meta .meta