From f7a823f5358d5990ddf21e19ddad6c4624c33334 Mon Sep 17 00:00:00 2001 From: Kunal Gupta <39487888+iamKunalGupta@users.noreply.github.com> Date: Mon, 11 Mar 2024 17:32:43 +0530 Subject: [PATCH] fix(telemetry): sns subject length (#1463) break before reaching 100 characters limit as limit is `<100` --- flow/shared/telemetry/sns_message_sender.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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),