Skip to content

Commit

Permalink
Fix internal error
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerollmops committed Sep 12, 2023
1 parent b7109c0 commit c158d03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions meilisearch/src/analytics/segment_analytics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ impl From<Opt> for Infos {
#[cfg(all(not(debug_assertions), feature = "analytics"))]
no_analytics: _,
zk_url: _,
s3_url: _,
} = options;

let schedule_snapshot = match schedule_snapshot {
Expand Down
10 changes: 7 additions & 3 deletions meilisearch/src/routes/indexes/documents.rs
Original file line number Diff line number Diff line change
@@ -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::web::Data;
Expand Down Expand Up @@ -395,7 +395,7 @@ async fn document_addition(
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))));
}

Expand All @@ -411,8 +411,12 @@ async fn document_addition(
};

if let Some(s3) = s3 {
update_file.seek(SeekFrom::Start(0)).unwrap();
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.
Expand Down

0 comments on commit c158d03

Please sign in to comment.