diff --git a/flow/shared/telemetry/sns_message_sender.go b/flow/shared/telemetry/sns_message_sender.go index 67cf3eebae..9d32dcf8f9 100644 --- a/flow/shared/telemetry/sns_message_sender.go +++ b/flow/shared/telemetry/sns_message_sender.go @@ -42,14 +42,14 @@ func (s *SNSMessageSenderImpl) SendMessage(ctx context.Context, subject string, var messageSubjectBuilder strings.Builder maxSubjectSize := 99 for currentLength, char := range subject { + if currentLength > maxSubjectSize { + break + } if unicode.IsPrint(char) { messageSubjectBuilder.WriteRune(char) } else { messageSubjectBuilder.WriteRune(' ') } - if currentLength > maxSubjectSize { - break - } } publish, err := s.client.Publish(ctx, &sns.PublishInput{ Message: aws.String(body),