Skip to content

Commit c49c43e

Browse files
committed
fix: bug fixes
1 parent e8b7cfa commit c49c43e

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

dth/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func loadDefaultConfig(ctx context.Context) (cfg aws.Config) {
7979
ctx,
8080
// config.WithClientLogMode(aws.LogRequest|aws.LogRequestWithBody),
8181
config.WithAPIOptions([]func(*middleware.Stack) error{
82-
mw.AddUserAgentKey("AWS/SO8001/v2.0.0"),
82+
mw.AddUserAgentKey("AWSSOLUTION/SO8001/v2.0.0"),
8383
}),
8484
)
8585
if err != nil {

dth/job.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,12 +611,12 @@ func (w *Worker) getTotalParts(size int64) (totalParts, chunkSize int) {
611611
maxParts := 10000
612612

613613
chunkSize = w.cfg.ChunkSize * MB
614-
totalParts = int(math.Ceil(float64(size) / float64(chunkSize)))
615614

616-
if totalParts > maxParts {
617-
totalParts = maxParts
618-
chunkSize = int(size/int64(maxParts)) + 1024
615+
if int64(maxParts*chunkSize) < size {
616+
chunkSize = int(size/int64(maxParts)) + 1
619617
}
618+
totalParts = int(math.Ceil(float64(size) / float64(chunkSize)))
619+
// log.Printf("Total parts: %d, chunk size: %d", totalParts, chunkSize)
620620
return
621621
}
622622

@@ -722,6 +722,7 @@ func (w *Worker) transfer(ctx context.Context, obj *Object, destKey *string, sta
722722
etag, err = w.desClient.PutObject(ctx, destKey, body, &w.cfg.DestStorageClass, &w.cfg.DestAcl, meta)
723723
}
724724

725+
body = nil // release memory
725726
if err != nil {
726727
return &TransferResult{
727728
status: "ERROR",

0 commit comments

Comments
 (0)