Skip to content

Commit

Permalink
sync: fixed bandwidth limit bug when streaming (#5046)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhijian-pro authored Aug 5, 2024
1 parent ff4f502 commit cba7747
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,6 @@ func doCopySingle(src, dst object.ObjectStorage, key string, size int64) error {
}

func doCopySingle0(src, dst object.ObjectStorage, key string, size int64) error {
if limiter != nil {
limiter.Wait(size)
}
concurrent <- 1
defer func() {
<-concurrent
Expand Down Expand Up @@ -432,6 +429,9 @@ type withProgress struct {
}

func (w *withProgress) Read(b []byte) (int, error) {
if limiter != nil {
limiter.Wait(int64(len(b)))
}
n, err := w.r.Read(b)
copiedBytes.IncrInt64(int64(n))
return n, err
Expand Down

0 comments on commit cba7747

Please sign in to comment.