Skip to content

Commit 8f9a09d

Browse files
fix(drivers/guangyapan): report multipart upload progress to copy task (#2989)
multipartUploadToOSS passed the UpdateProgress callback into stream.NewStreamSectionReader, which ignores the up argument, so the callback was never invoked while uploading parts. As a result, cross-storage copy tasks targeting GuangYaPan stayed at 0% and showed no progress bar or speed in the task list. Fix by tracking the uploaded byte count and invoking up after every part is uploaded, keeping consistent with other drivers' upload flow. Co-authored-by: Pikachu Ren <40362270+PIKACHUIM@users.noreply.github.com>
1 parent 394bb8f commit 8f9a09d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎drivers/guangyapan/util.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ func (d *GuangYaPan) multipartUploadToOSS(ctx context.Context, bucket *oss.Bucke
241241
}
242242

243243
parts := make([]oss.UploadPart, 0, partCount)
244+
var uploaded int64
244245
for i := 0; i < partCount; i++ {
245246
if utils.IsCanceled(ctx) {
246247
return ctx.Err()
@@ -273,6 +274,10 @@ func (d *GuangYaPan) multipartUploadToOSS(ctx context.Context, bucket *oss.Bucke
273274
return fmt.Errorf("failed to upload part %d: %w", i+1, err)
274275
}
275276
parts = append(parts, part)
277+
uploaded += length
278+
if total > 0 {
279+
up(100 * float64(uploaded) / float64(total))
280+
}
276281
}
277282

278283
_, err = bucket.CompleteMultipartUpload(imur, parts)

0 commit comments

Comments
 (0)