Skip to content

Commit

Permalink
api: Update progress bar concurrently. (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored and deekoder committed Jun 30, 2017
1 parent fa13434 commit 982f4fb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
7 changes: 0 additions & 7 deletions api-put-object-multipart.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,6 @@ func (c Client) putObjectMultipartNoStream(bucketName, objectName string, reader
// Save successfully uploaded part metadata.
partsInfo[partNumber] = objPart

// Update the progress reader for the skipped part.
if progress != nil {
if _, err = io.CopyN(ioutil.Discard, progress, prtSize); err != nil {
return totalUploadedSize, err
}
}

// Reset the temporary buffer.
tmpBuffer.Reset()

Expand Down
9 changes: 1 addition & 8 deletions api-put-object-streaming.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package minio
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"sort"
"strings"
Expand Down Expand Up @@ -165,7 +164,7 @@ func (c Client) putObjectMultipartStreamFromReadAt(bucketName, objectName string
}

// Get a section reader on a particular offset.
sectionReader := io.NewSectionReader(reader, readOffset, partSize)
sectionReader := newHook(io.NewSectionReader(reader, readOffset, partSize), progress)

// Proceed to upload the part.
var objPart ObjectPart
Expand Down Expand Up @@ -209,12 +208,6 @@ func (c Client) putObjectMultipartStreamFromReadAt(bucketName, objectName string
}
// Update the totalUploadedSize.
totalUploadedSize += uploadRes.Size
// Update the progress bar if there is one.
if progress != nil {
if _, err = io.CopyN(ioutil.Discard, progress, uploadRes.Size); err != nil {
return totalUploadedSize, err
}
}
// Store the parts to be completed in order.
complMultipartUpload.Parts = append(complMultipartUpload.Parts, CompletePart{
ETag: part.ETag,
Expand Down

0 comments on commit 982f4fb

Please sign in to comment.