From 4c58c727255e0c1200c6cf9a3bd0d01226226cd3 Mon Sep 17 00:00:00 2001 From: Callum Morris Date: Wed, 6 Aug 2025 11:08:03 +1200 Subject: [PATCH 1/2] fix: change sqs body max size to 1 MiB https://aws.amazon.com/about-aws/whats-new/2025/08/amazon-sqs-max-payload-size-1mib/ Also changed to use strings.Repeat, as the way it was being done was really slow. --- .github/workflows/build.yml | 2 +- aws/sqs/sqs.go | 2 +- aws/sqs/sqs_integration_test.go | 21 ++++++--------------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 141e084..334c77f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: uses: GeoNet/Actions/.github/workflows/reusable-go-apps.yml@main with: testSetup: | - docker run --name localstack -d --rm -p 4566:4566 -p 4510-4559:4510-4559 docker.io/localstack/localstack:4.0.3 + docker run --name localstack -d --rm -p 4566:4566 -p 4510-4559:4510-4559 docker.io/localstack/localstack:4.10.0 echo "waiting for localstack to be ready" until curl -v localhost:4566; do sleep 1s diff --git a/aws/sqs/sqs.go b/aws/sqs/sqs.go index cc10211..ca7eba4 100644 --- a/aws/sqs/sqs.go +++ b/aws/sqs/sqs.go @@ -353,7 +353,7 @@ func (s *SQS) SendNBatch(ctx context.Context, queueURL string, bodies []string) const ( maxCount = 10 - maxSize = 262144 // 256 KiB + maxSize = 1048576 // 1 MiB ) allErrors := make([]error, 0) diff --git a/aws/sqs/sqs_integration_test.go b/aws/sqs/sqs_integration_test.go index 90e13f3..59e2734 100644 --- a/aws/sqs/sqs_integration_test.go +++ b/aws/sqs/sqs_integration_test.go @@ -455,11 +455,8 @@ func TestSendBatch(t *testing.T) { require.Nil(t, err, fmt.Sprintf("error creating sqs client: %v", err)) // ACTION - var maxBytes int = 262144 - maxSizeSingleMessage := "" - for range maxBytes { - maxSizeSingleMessage += "a" - } + var maxBytes int = 1048576 + maxSizeSingleMessage := strings.Repeat("a", maxBytes) err = client.SendBatch(context.TODO(), awsCmdQueueURL(), []string{maxSizeSingleMessage}) // ASSERT @@ -474,11 +471,8 @@ func TestSendBatch(t *testing.T) { assert.NotNil(t, err) // ACTION - var maxHalfBytes int = 131072 - maxHalfSizeMessage := "" - for range maxHalfBytes { - maxHalfSizeMessage += "a" - } + var maxHalfBytes int = 524288 + maxHalfSizeMessage := strings.Repeat("a", maxHalfBytes) err = client.SendBatch(context.TODO(), awsCmdQueueURL(), []string{maxHalfSizeMessage, maxHalfSizeMessage}) // ASSERT @@ -531,11 +525,8 @@ func TestSendNBatch(t *testing.T) { require.Nil(t, err, fmt.Sprintf("error creating sqs client: %v", err)) // ACTION - var maxBytes int = 262144 - maxSizeSingleMessage := "" - for range maxBytes { - maxSizeSingleMessage += "a" - } + var maxBytes int = 1048576 + maxSizeSingleMessage := strings.Repeat("a", maxBytes) batchesSent, err := client.SendNBatch(context.TODO(), awsCmdQueueURL(), []string{maxSizeSingleMessage, maxSizeSingleMessage}) // ASSERT From ec7923f9e655b45d23de158a153de6d2f2841759 Mon Sep 17 00:00:00 2001 From: Callum Morris Date: Thu, 27 Nov 2025 11:32:47 +1300 Subject: [PATCH 2/2] nfc: add clarification of package intent to readme --- aws/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aws/README.md b/aws/README.md index 38eaab2..f1f0168 100644 --- a/aws/README.md +++ b/aws/README.md @@ -1,3 +1,4 @@ ## Wrapper files for AWS-SDK-GO ## -These files are to simplify how applications interact with the AWS SDK for Go. \ No newline at end of file +These files are to simplify how applications interact with the AWS SDK for Go. +The functions are expected to be in line with the underlying AWS service.