mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-12 22:36:29 +01:00
Wrap the read NDJSON pass into a tokio blocking
This commit is contained in:
parent
01bcc601be
commit
5622b9607d
@ -624,12 +624,19 @@ async fn document_addition(
|
|||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let documents_count = file.as_ref().map_or(Ok(0), |ntf| {
|
let documents_count = tokio::task::spawn_blocking(move || {
|
||||||
read_ndjson(ntf.as_file()).map_err(MeilisearchHttpError::DocumentFormat)
|
let documents_count = file.as_ref().map_or(Ok(0), |ntf| {
|
||||||
})?;
|
read_ndjson(ntf.as_file()).map_err(MeilisearchHttpError::DocumentFormat)
|
||||||
let update_file = file_store::File::from_parts(path, file);
|
})?;
|
||||||
update_file.persist()?;
|
|
||||||
Ok(Ok(documents_count))
|
let update_file = file_store::File::from_parts(path, file);
|
||||||
|
update_file.persist()?;
|
||||||
|
|
||||||
|
Ok(documents_count)
|
||||||
|
})
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(documents_count)
|
||||||
}
|
}
|
||||||
PayloadType::Json | PayloadType::Csv { delimiter: _ } => {
|
PayloadType::Json | PayloadType::Csv { delimiter: _ } => {
|
||||||
let temp_file = match tempfile() {
|
let temp_file = match tempfile() {
|
||||||
|
Loading…
Reference in New Issue
Block a user