Improve concurrency for upload streams part 2

This commit is contained in:
asonix 2022-09-25 08:27:11 -05:00
parent bf3c47e457
commit dc95417846

View file

@ -188,6 +188,7 @@ impl Store for ObjectStore {
quick_xml::de::from_reader(&*body).map_err(ObjectError::from)?; quick_xml::de::from_reader(&*body).map_err(ObjectError::from)?;
let upload_id = &body.upload_id; let upload_id = &body.upload_id;
// hack-ish: use async block as Result boundary
let res = async { let res = async {
let mut complete = false; let mut complete = false;
let mut part_number = 0; let mut part_number = 0;
@ -230,6 +231,7 @@ impl Store for ObjectStore {
.map_err(|_| ObjectError::Etag)? .map_err(|_| ObjectError::Etag)?
.to_string(); .to_string();
// early-drop response to close its tracing spans
drop(response); drop(response);
Ok(etag) as Result<String, Error> Ok(etag) as Result<String, Error>
@ -240,6 +242,9 @@ impl Store for ObjectStore {
futures.push(handle); futures.push(handle);
} }
// early-drop stream to allow the next Part to be polled concurrently
drop(stream);
let mut etags = Vec::new(); let mut etags = Vec::new();
for future in futures { for future in futures {