mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
cleaner code
This commit is contained in:
parent
9f50b310a0
commit
e3f40d538d
|
@ -127,6 +127,7 @@ func (s3sink *S3Sink) CreateEntry(key string, entry *filer_pb.Entry, signatures
|
|||
|
||||
parts := make([]*s3.CompletedPart, len(chunkViews))
|
||||
|
||||
if len(parts) > 0 {
|
||||
var wg sync.WaitGroup
|
||||
for chunkIndex, chunk := range chunkViews {
|
||||
partId := chunkIndex + 1
|
||||
|
@ -142,14 +143,13 @@ func (s3sink *S3Sink) CreateEntry(key string, entry *filer_pb.Entry, signatures
|
|||
}(chunk, chunkIndex)
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
} else if len(entry.Content) > 0 {
|
||||
// for small files
|
||||
if len(entry.Content) > 0 {
|
||||
parts = make([]*s3.CompletedPart, 1)
|
||||
if part, uploadErr := s3sink.doUploadPart(key, uploadId, 1, bytes.NewReader(entry.Content)); uploadErr != nil {
|
||||
err = uploadErr
|
||||
glog.Errorf("uploadPart: %v", uploadErr)
|
||||
} else {
|
||||
parts = make([]*s3.CompletedPart, 1)
|
||||
parts[0] = part
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue