mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-11 15:38:55 +01:00
move flush in write_to_file function
This commit is contained in:
parent
880fc069bd
commit
f68c257452
@ -145,11 +145,15 @@ where
|
|||||||
D: AsRef<[u8]> + Sized + 'static,
|
D: AsRef<[u8]> + Sized + 'static,
|
||||||
{
|
{
|
||||||
let mut file_len = 0;
|
let mut file_len = 0;
|
||||||
|
|
||||||
while let Some(bytes) = payload.recv().await {
|
while let Some(bytes) = payload.recv().await {
|
||||||
let bytes = bytes?;
|
let bytes = bytes?;
|
||||||
file_len += bytes.as_ref().len();
|
file_len += bytes.as_ref().len();
|
||||||
file.write_all(bytes.as_ref()).await?;
|
file.write_all(bytes.as_ref()).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file.flush().await?;
|
||||||
|
|
||||||
Ok(file_len)
|
Ok(file_len)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +161,6 @@ where
|
|||||||
|
|
||||||
match file_len {
|
match file_len {
|
||||||
Ok(len) if len > 0 => {
|
Ok(len) if len > 0 => {
|
||||||
file.flush().await?;
|
|
||||||
let file = file.into_std().await;
|
let file = file.into_std().await;
|
||||||
Some((file, update_file_id))
|
Some((file, update_file_id))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user