Skip to content

Commit

Permalink
fix: change cp chunk size limit to 4MB
Browse files Browse the repository at this point in the history
A limit of 5MB raw bytes is too high as it becomes 6.67MB after 
base64-encoding, which is greater than the Lambda payload limit of 6MB.
  • Loading branch information
aidansteele authored Jun 23, 2021
1 parent f8974f4 commit 35cf84b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/lambda/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/pkg/errors"
"io"
"os"
"fmt"
)

func handleDownload(ctx context.Context, input *efsu.Input) (*efsu.Output, error) {
Expand All @@ -26,7 +27,7 @@ func handleDownload(ctx context.Context, input *efsu.Input) (*efsu.Output, error
fRange.Size = info.Size()
}

var limit int64 = 5e6
var limit int64 = 4e6
if fRange.Size > limit {
fRange.Size = limit
}
Expand All @@ -45,6 +46,8 @@ func handleDownload(ctx context.Context, input *efsu.Input) (*efsu.Output, error
if err != nil {
return nil, errors.WithStack(err)
}

fmt.Printf("cp fileSize=%d offset=%d rangeLen=%d read=%d\n", info.Size(), fRange.Offset, fRange.Size, copied)

if copied != fRange.Size {
return nil, errors.New("too little data read")
Expand Down

0 comments on commit 35cf84b

Please sign in to comment.