From d79feb6536540db2b35bf64e7fab3cb3dc1fbead Mon Sep 17 00:00:00 2001 From: Hannes de Jager Date: Fri, 21 Aug 2020 13:16:36 +0200 Subject: [PATCH] 2x speed on GET for filesystem back-end --- src/storage/filesystem.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/storage/filesystem.rs b/src/storage/filesystem.rs index 5f6b9a87..d685927a 100644 --- a/src/storage/filesystem.rs +++ b/src/storage/filesystem.rs @@ -65,7 +65,7 @@ impl Filesystem { #[async_trait] impl StorageBackend for Filesystem { - type File = tokio::fs::File; + type File = tokio::io::BufReader; type Metadata = std::fs::Metadata; fn supported_features(&self) -> u32 { @@ -117,7 +117,7 @@ impl StorageBackend for Filesystem { if start_pos > 0 { file.seek(std::io::SeekFrom::Start(start_pos)).await?; } - Ok(file) + Ok(tokio::io::BufReader::new(file)) } .map_err(|error: std::io::Error| match error.kind() { std::io::ErrorKind::NotFound => Error::from(ErrorKind::PermanentFileNotAvailable),