From dc9541784614b044f671ce26a4ca4729a7a4b06b Mon Sep 17 00:00:00 2001 From: asonix Date: Sun, 25 Sep 2022 08:27:11 -0500 Subject: [PATCH] Improve concurrency for upload streams part 2 --- src/store/object_store.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/store/object_store.rs b/src/store/object_store.rs index 9fe0425..f9b01b2 100644 --- a/src/store/object_store.rs +++ b/src/store/object_store.rs @@ -188,6 +188,7 @@ impl Store for ObjectStore { quick_xml::de::from_reader(&*body).map_err(ObjectError::from)?; let upload_id = &body.upload_id; + // hack-ish: use async block as Result boundary let res = async { let mut complete = false; let mut part_number = 0; @@ -230,6 +231,7 @@ impl Store for ObjectStore { .map_err(|_| ObjectError::Etag)? .to_string(); + // early-drop response to close its tracing spans drop(response); Ok(etag) as Result @@ -240,6 +242,9 @@ impl Store for ObjectStore { futures.push(handle); } + // early-drop stream to allow the next Part to be polled concurrently + drop(stream); + let mut etags = Vec::new(); for future in futures {