From 9cac6a6d59fed05422bb279733c2110f8fd9a485 Mon Sep 17 00:00:00 2001 From: Pavel Kirilin Date: Thu, 24 Feb 2022 17:58:01 +0400 Subject: [PATCH] Add sync for files. (#45) Signed-off-by: Pavel Kirilin --- Cargo.toml | 2 +- src/info_storages/file_info_storage.rs | 1 + src/storages/file_storage.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e6dfa2e..d634cad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -113,5 +113,5 @@ httptest = "0.15.4" [profile.release] lto = true panic = "abort" -opt-level = 2 +opt-level = 3 codegen-units = 1 diff --git a/src/info_storages/file_info_storage.rs b/src/info_storages/file_info_storage.rs index 993f312..fad265b 100644 --- a/src/info_storages/file_info_storage.rs +++ b/src/info_storages/file_info_storage.rs @@ -50,6 +50,7 @@ impl InfoStorage for FileInfoStorage { err })?; copy(&mut data.as_bytes(), &mut file).await?; + file.sync_data().await?; Ok(()) } diff --git a/src/storages/file_storage.rs b/src/storages/file_storage.rs index a89985a..2653412 100644 --- a/src/storages/file_storage.rs +++ b/src/storages/file_storage.rs @@ -97,6 +97,7 @@ impl Storage for FileStorage { })?; let mut reader = BufReader::new(bytes); copy(&mut reader, &mut file).await?; + file.sync_data().await?; Ok(()) }