From a83e2ffeab6678239e8060425f660593573ecc1d Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 22 Sep 2020 13:27:23 +0200 Subject: [PATCH] src/api2/reader.rs: use std::fs::read instead of tokio::fs::read Because it is about 10%& faster this way. --- src/api2/reader.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/api2/reader.rs b/src/api2/reader.rs index 0a72e349..2c0765c5 100644 --- a/src/api2/reader.rs +++ b/src/api2/reader.rs @@ -229,8 +229,7 @@ fn download_chunk( env.debug(format!("download chunk {:?}", path)); - let data = tokio::fs::read(path) - .await + let data = tools::runtime::block_in_place(|| std::fs::read(path)) .map_err(move |err| http_err!(BAD_REQUEST, "reading file {:?} failed: {}", path2, err))?; let body = Body::from(data);