Skip to content
Snippets Groups Projects
Commit 1e86cfd6 authored by Johan de Klerk's avatar Johan de Klerk
Browse files

#24: Correctly check message length

parent cd3f50e4
Branches
Tags
1 merge request!19Resolve "Upload large SQS messages to S3"
...@@ -3,7 +3,6 @@ package sqs ...@@ -3,7 +3,6 @@ package sqs
/*Package sqs provides a simple interface to send messages to AWS SQS*/ /*Package sqs provides a simple interface to send messages to AWS SQS*/
import ( import (
"encoding/binary"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/google/uuid" "github.com/google/uuid"
...@@ -127,7 +126,7 @@ func SendSQSMessage(msgr Messenger, objectToSend interface{}, currentRequestID * ...@@ -127,7 +126,7 @@ func SendSQSMessage(msgr Messenger, objectToSend interface{}, currentRequestID *
// If bigger than 200 KB upload message to s3 and send s3 file name to sqs // 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 // The sqs receiver should check the header to see if the message is in the body or on s3
if binary.Size(message) > 0 { if len(jsonBytes) > 0 {
headers[SQSMessageOnS3Key] = "true" headers[SQSMessageOnS3Key] = "true"
id := uuid.New() id := uuid.New()
filename := fmt.Sprintf("%v-%v", sqsType, id.String()) filename := fmt.Sprintf("%v-%v", sqsType, id.String())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment