From 35cf84b8aa5b352c92e46e7e61a51072488390ff Mon Sep 17 00:00:00 2001 From: Aidan Steele Date: Wed, 23 Jun 2021 12:48:06 +1000 Subject: [PATCH] fix: change cp chunk size limit to 4MB 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. --- cmd/lambda/download.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/lambda/download.go b/cmd/lambda/download.go index 35db1bb..24a9381 100644 --- a/cmd/lambda/download.go +++ b/cmd/lambda/download.go @@ -7,6 +7,7 @@ import ( "github.com/pkg/errors" "io" "os" + "fmt" ) func handleDownload(ctx context.Context, input *efsu.Input) (*efsu.Output, error) { @@ -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 } @@ -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")