Skip to content

Commit e09eda4

Browse files
committed
fix(uploads): fire multipart progress callback under the lock
1 parent f9b8ee1 commit e09eda4

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎hotdata/uploads.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,10 +799,14 @@ def upload_part(index: int) -> FinalizeUploadPart:
799799
if not etag:
800800
raise MissingETagError(part_number=part_number)
801801
if progress is not None:
802+
# Fire the callback under the lock so delivery order matches the
803+
# computed order: releasing the lock first would let two workers
804+
# race and deliver ticks out of order, breaking the documented
805+
# monotonically-non-decreasing guarantee. Callbacks are expected
806+
# to be cheap (and do their own locking), so serializing is fine.
802807
with lock:
803808
done[0] = min(done[0] + length, total)
804-
current = done[0]
805-
progress(current, total)
809+
progress(done[0], total)
806810
return FinalizeUploadPart(e_tag=etag, part_number=part_number)
807811

808812
results: List[Optional[FinalizeUploadPart]] = [None] * len(part_urls)

0 commit comments

Comments
 (0)