From 0d868f36d74dea24748d507056eb4e20285461e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Wed, 11 Sep 2024 18:38:04 +0200 Subject: [PATCH] Make sure we always use a BufWriter to write the update files --- meilisearch-types/src/document_formats.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meilisearch-types/src/document_formats.rs b/meilisearch-types/src/document_formats.rs index 4b9d59462..b40c4d0b6 100644 --- a/meilisearch-types/src/document_formats.rs +++ b/meilisearch-types/src/document_formats.rs @@ -244,10 +244,11 @@ pub fn read_json(input: &File, output: impl io::Write) -> Result { } /// Reads NDJSON from file and write it in NDJSON in a file checking it along the way. -pub fn read_ndjson(input: &File, mut output: impl io::Write) -> Result { +pub fn read_ndjson(input: &File, output: impl io::Write) -> Result { // We memory map to be able to deserailize into a TopLevelMap<'pl> that // does not allocate when possible and only materialize the first/top level. let input = unsafe { Mmap::map(input).map_err(DocumentFormatError::Io)? }; + let mut output = BufWriter::new(output); let mut count = 0; for result in serde_json::Deserializer::from_slice(&input).into_iter() {