diff --git a/src/info_storages/file_info_storage.rs b/src/info_storages/file_info_storage.rs index fe8ccf14ea9368f6187e1cadf9ab1a2fa0f60c44..338ac6800406dfe8166fab78f8028eb3fe8105eb 100644 --- a/src/info_storages/file_info_storage.rs +++ b/src/info_storages/file_info_storage.rs @@ -59,6 +59,7 @@ impl InfoStorage for FileInfoStorage { .to_string(), ) })?; + file.sync_data().await?; Ok(()) } diff --git a/src/storages/file_storage.rs b/src/storages/file_storage.rs index a8dbd6e37c379591c5c51033c0075f154517ee66..b6b7419cdb6223fd0d07e1304ae85a2fa20b0958 100644 --- a/src/storages/file_storage.rs +++ b/src/storages/file_storage.rs @@ -144,6 +144,7 @@ impl Storage for FileStorage { error!("{:?}", err); RustusError::UnableToWrite(info.path.clone().unwrap()) })?; + file.sync_data().await?; // Updating information about file. info.offset += bytes.len(); self.info_storage.set_info(&info, false).await?; @@ -180,7 +181,7 @@ impl Storage for FileStorage { error!("{:?}", err); RustusError::UnableToWrite(file_path.display().to_string()) })?; - + file.sync_all().await?; // Creating new FileInfo object and saving it. let file_info = FileInfo::new( file_id.as_str(),