Fix internal error

This commit is contained in:
Clément Renault 2023-09-12 11:50:31 +02:00
parent b7109c0fd2
commit c158d03337
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F
2 changed files with 8 additions and 3 deletions

View File

@ -313,6 +313,7 @@ impl From<Opt> for Infos {
#[cfg(all(not(debug_assertions), feature = "analytics"))] #[cfg(all(not(debug_assertions), feature = "analytics"))]
no_analytics: _, no_analytics: _,
zk_url: _, zk_url: _,
s3_url: _,
} = options; } = options;
let schedule_snapshot = match schedule_snapshot { let schedule_snapshot = match schedule_snapshot {

View File

@ -1,4 +1,4 @@
use std::io::{BufReader, ErrorKind}; use std::io::{BufReader, ErrorKind, Seek, SeekFrom};
use actix_web::http::header::CONTENT_TYPE; use actix_web::http::header::CONTENT_TYPE;
use actix_web::web::Data; use actix_web::web::Data;
@ -395,7 +395,7 @@ async fn document_addition(
return Err(MeilisearchHttpError::MissingPayload(format)); return Err(MeilisearchHttpError::MissingPayload(format));
} }
if let Err(e) = buffer.seek(std::io::SeekFrom::Start(0)).await { if let Err(e) = buffer.seek(SeekFrom::Start(0)).await {
return Err(MeilisearchHttpError::Payload(ReceivePayload(Box::new(e)))); return Err(MeilisearchHttpError::Payload(ReceivePayload(Box::new(e))));
} }
@ -411,8 +411,12 @@ async fn document_addition(
}; };
if let Some(s3) = s3 { if let Some(s3) = s3 {
update_file.seek(SeekFrom::Start(0)).unwrap();
let mut reader = BufReader::new(&*update_file); let mut reader = BufReader::new(&*update_file);
s3.put_object_stream(&mut reader, format!("/update-files/{}", uuid)).unwrap(); match s3.put_object_stream(&mut reader, format!("/update-files/{}", uuid)) {
Ok(_) | Err(s3::error::S3Error::Http(_, _)) => (),
Err(e) => panic!("Error {}", e),
}
} }
// we NEED to persist the file here because we moved the `udpate_file` in another task. // we NEED to persist the file here because we moved the `udpate_file` in another task.