Skip to content

Commit

Permalink
Fix multiple part uploads at once making vector size inconsistent (ap…
Browse files Browse the repository at this point in the history
…ache#2681)

* Fix multiple part uploads at once making vector size inconsistent

* Calculate total_parts prior to resizing the vector
  • Loading branch information
gruuya authored Sep 8, 2022
1 parent 0b59f05 commit 566ef3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion object_store/src/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ where
if self.tasks.is_empty() {
return Ok(());
}
let total_parts = self.completed_parts.len();
while let Poll::Ready(Some(res)) = self.tasks.poll_next_unpin(cx) {
let (part_idx, part) = res?;
let total_parts = self.completed_parts.len();
self.completed_parts
.resize(std::cmp::max(part_idx + 1, total_parts), None);
self.completed_parts[part_idx] = Some(part);
Expand Down

0 comments on commit 566ef3d

Please sign in to comment.