Skip to content
Snippets Groups Projects
Commit 056ff023 authored by Francé Wilke's avatar Francé Wilke
Browse files

Limit SQS messages to 200 KB

parent 2b0d58f7
Branches
Tags v1.15.0
No related merge requests found
......@@ -126,10 +126,12 @@ func SendSQSMessage(msgr Messenger, objectToSend interface{}, currentRequestID *
// If bigger than 200 KB upload message to s3 and send s3 file name to sqs
// The sqs receiver should check the header to see if the message is in the body or on s3
if len(jsonBytes) > 0 {
if len(jsonBytes) > 200000 {
headers[SQSMessageOnS3Key] = "true"
id := uuid.New()
filename := fmt.Sprintf("%v-%v", sqsType, id.String())
logs.Info("SQS message too big, saving to S3 with filename = %s", filename)
err := uploadMessageToS3(msgr.S3Session, msgr.S3BucketName, filename, jsonBytes)
if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment