mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +08:00
tokio file write update
This commit is contained in:
parent
5a770ffe47
commit
6bdd37beb8
@ -1,11 +1,3 @@
|
|||||||
use crate::analytics::{Analytics, DocumentDeletionKind};
|
|
||||||
use crate::error::MeilisearchHttpError;
|
|
||||||
use crate::error::PayloadError::ReceivePayloadErr;
|
|
||||||
use crate::extractors::authentication::policies::*;
|
|
||||||
use crate::extractors::authentication::GuardedData;
|
|
||||||
use crate::extractors::payload::Payload;
|
|
||||||
use crate::extractors::sequential_extractor::SeqHandler;
|
|
||||||
use crate::routes::{fold_star_or, PaginationView, SummarizedTaskView};
|
|
||||||
use actix_web::http::header::CONTENT_TYPE;
|
use actix_web::http::header::CONTENT_TYPE;
|
||||||
use actix_web::web::Data;
|
use actix_web::web::Data;
|
||||||
use actix_web::{web, HttpMessage, HttpRequest, HttpResponse};
|
use actix_web::{web, HttpMessage, HttpRequest, HttpResponse};
|
||||||
@ -31,6 +23,15 @@ use tempfile::NamedTempFile;
|
|||||||
use tokio::fs::File;
|
use tokio::fs::File;
|
||||||
use tokio::io::AsyncWriteExt;
|
use tokio::io::AsyncWriteExt;
|
||||||
|
|
||||||
|
use crate::analytics::{Analytics, DocumentDeletionKind};
|
||||||
|
use crate::error::MeilisearchHttpError;
|
||||||
|
use crate::error::PayloadError::ReceivePayloadErr;
|
||||||
|
use crate::extractors::authentication::policies::*;
|
||||||
|
use crate::extractors::authentication::GuardedData;
|
||||||
|
use crate::extractors::payload::Payload;
|
||||||
|
use crate::extractors::sequential_extractor::SeqHandler;
|
||||||
|
use crate::routes::{fold_star_or, PaginationView, SummarizedTaskView};
|
||||||
|
|
||||||
static ACCEPTED_CONTENT_TYPE: Lazy<Vec<String>> = Lazy::new(|| {
|
static ACCEPTED_CONTENT_TYPE: Lazy<Vec<String>> = Lazy::new(|| {
|
||||||
vec!["application/json".to_string(), "application/x-ndjson".to_string(), "text/csv".to_string()]
|
vec!["application/json".to_string(), "application/x-ndjson".to_string(), "text/csv".to_string()]
|
||||||
});
|
});
|
||||||
@ -262,11 +263,6 @@ async fn document_addition(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = buffer.flush().await {
|
|
||||||
error!("bufWriter flush error: {}", e);
|
|
||||||
return Err(MeilisearchHttpError::Payload(ReceivePayloadErr));
|
|
||||||
};
|
|
||||||
|
|
||||||
if buffer_write_size == 0 {
|
if buffer_write_size == 0 {
|
||||||
return Err(MeilisearchHttpError::MissingPayload(format));
|
return Err(MeilisearchHttpError::MissingPayload(format));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user