src/api2/reader.rs: use std::fs::read instead of tokio::fs::read

Because it is about 10%& faster this way.
This commit is contained in:
Dietmar Maurer 2020-09-22 13:27:23 +02:00
parent 5d7449a121
commit a83e2ffeab

View File

@ -229,8 +229,7 @@ fn download_chunk(
env.debug(format!("download chunk {:?}", path)); env.debug(format!("download chunk {:?}", path));
let data = tokio::fs::read(path) let data = tools::runtime::block_in_place(|| std::fs::read(path))
.await
.map_err(move |err| http_err!(BAD_REQUEST, "reading file {:?} failed: {}", path2, err))?; .map_err(move |err| http_err!(BAD_REQUEST, "reading file {:?} failed: {}", path2, err))?;
let body = Body::from(data); let body = Body::from(data);