mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-11-22 04:36:32 +00:00
Retrieve the bytesMut only when released
This commit is contained in:
committed by
Clément Renault
parent
3ec4750426
commit
98be43b66b
@@ -353,10 +353,13 @@ impl IndexScheduler {
|
||||
// Wait for a buffer to be ready if there are in-flight parts that landed
|
||||
let mut buffer = if in_flight.len() >= max_in_flight_parts {
|
||||
let (request, buffer) = in_flight.pop_front().unwrap();
|
||||
let mut buffer = buffer.try_into_mut().expect("Valid to convert into BytesMut");
|
||||
let resp = request.await.unwrap().unwrap().error_for_status().unwrap();
|
||||
let etag =
|
||||
resp.headers().get(ETAG).expect("every UploadPart request returns an Etag");
|
||||
let mut buffer = match buffer.try_into_mut() {
|
||||
Ok(buffer) => buffer,
|
||||
Err(_) => panic!("Valid to convert into BytesMut"),
|
||||
};
|
||||
// TODO use bumpalo to reduce the number of allocations
|
||||
etags.push(etag.to_str().unwrap().to_owned());
|
||||
buffer.clear();
|
||||
|
||||
Reference in New Issue
Block a user