optimize file opening

feature/v32-tokens
Edward Shen 2021-05-20 14:23:16 -04:00
parent ea8e031a3d
commit 7acc126de2
Signed by: edward
GPG Key ID: 19182661E818369F
1 changed files with 1 additions and 2 deletions

3
src/cache/fs.rs vendored
View File

@ -78,8 +78,7 @@ static WRITING_STATUS: Lazy<RwLock<HashMap<PathBuf, Receiver<WritingStatus>>>> =
pub(super) async fn read_file(
path: &Path,
) -> Option<Result<(InnerStream, Option<Header>, ImageMetadata), std::io::Error>> {
let std_file = std::fs::File::open(path).ok()?;
let mut file = File::from_std(std_file.try_clone().ok()?);
let mut file = File::open(path).await.ok()?;
let mut reader = {
// If the encryption key was set, use the encrypted disk reader instead;