fix: update error levels and integer handling
Signed-off-by: Mike Nguyen <hey@mike.ee>
This commit is contained in:
parent
c9ece74992
commit
470defedc7
|
@ -53,13 +53,13 @@ func (a *AuthStatic) AuthTest() bool {
|
|||
func (a *AuthStatic) GetAWSCredentialsProvider() aws.CredentialsProvider {
|
||||
switch {
|
||||
case a.accessKey == nil:
|
||||
a.logger.Error("accessKey is nil")
|
||||
a.logger.Debug("accessKey is nil")
|
||||
return nil
|
||||
case a.secretKey == nil:
|
||||
a.logger.Error("secretKey is nil")
|
||||
a.logger.Debug("secretKey is nil")
|
||||
return nil
|
||||
case a.sessionToken == nil:
|
||||
a.logger.Error("sessionToken is nil")
|
||||
a.logger.Debug("sessionToken is nil")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ type snsSqsMetadata struct {
|
|||
// see: https://aws.amazon.com/blogs/compute/solving-complex-ordering-challenges-with-amazon-sqs-fifo-queues/
|
||||
FifoMessageGroupID string `mapstructure:"fifoMessageGroupID"`
|
||||
// amount of time in seconds that a message is hidden from receive requests after it is sent to a subscriber. Default: 10.
|
||||
MessageVisibilityTimeout int64 `mapstructure:"messageVisibilityTimeout"`
|
||||
MessageVisibilityTimeout int32 `mapstructure:"messageVisibilityTimeout"`
|
||||
// number of times to resend a message after processing of that message fails before removing that message from the queue. Default: 10.
|
||||
MessageRetryLimit int64 `mapstructure:"messageRetryLimit"`
|
||||
// upon reaching the messageRetryLimit, disables the default deletion behaviour of the message from the SQS queue, and resetting the message visibilty on SQS
|
||||
|
@ -47,9 +47,9 @@ type snsSqsMetadata struct {
|
|||
// before it is moved to the dead-letters queue. This value must be smaller than messageRetryLimit.
|
||||
MessageReceiveLimit int64 `mapstructure:"messageReceiveLimit"`
|
||||
// amount of time to await receipt of a message before making another request. Default: 2.
|
||||
MessageWaitTimeSeconds int64 `mapstructure:"messageWaitTimeSeconds"`
|
||||
MessageWaitTimeSeconds int32 `mapstructure:"messageWaitTimeSeconds"`
|
||||
// maximum number of messages to receive from the queue at a time. Default: 10, Maximum: 10.
|
||||
MessageMaxNumber int64 `mapstructure:"messageMaxNumber"`
|
||||
MessageMaxNumber int32 `mapstructure:"messageMaxNumber"`
|
||||
// disable resource provisioning of SNS and SQS.
|
||||
DisableEntityManagement bool `mapstructure:"disableEntityManagement"`
|
||||
// assets creation timeout.
|
||||
|
|
|
@ -18,7 +18,6 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -603,22 +602,12 @@ func (s *snsSqs) callHandler(ctx context.Context, message *sqsTypes.Message, que
|
|||
func (s *snsSqs) consumeSubscription(ctx context.Context, queueInfo, deadLettersQueueInfo *sqsQueueInfo) {
|
||||
sqsPullExponentialBackoff := s.backOffConfig.NewBackOffWithContext(ctx)
|
||||
|
||||
// Check for overflows
|
||||
switch {
|
||||
case s.metadata.MessageMaxNumber >= math.MinInt32 && s.metadata.MessageMaxNumber <= math.MaxInt32:
|
||||
s.logger.Errorf("messageMaxNumber is out of range. It should be between %d and %d", math.MinInt32, math.MaxInt32)
|
||||
case s.metadata.MessageVisibilityTimeout >= math.MinInt32 && s.metadata.MessageVisibilityTimeout <= math.MaxInt32:
|
||||
s.logger.Errorf("messageVisibilityTimeout is out of range. It should be between %d and %d", math.MinInt32, math.MaxInt32)
|
||||
case s.metadata.MessageWaitTimeSeconds >= math.MinInt32 && s.metadata.MessageWaitTimeSeconds <= math.MaxInt32:
|
||||
s.logger.Errorf("messageWaitTimeSeconds is out of range. It should be between %d and %d", math.MinInt32, math.MaxInt32)
|
||||
}
|
||||
|
||||
receiveMessageInput := &sqs.ReceiveMessageInput{
|
||||
AttributeNames: []sqsTypes.QueueAttributeName{sqsTypes.QueueAttributeNameAll},
|
||||
MaxNumberOfMessages: int32(s.metadata.MessageMaxNumber),
|
||||
MaxNumberOfMessages: s.metadata.MessageMaxNumber,
|
||||
QueueUrl: aws.String(queueInfo.url),
|
||||
VisibilityTimeout: int32(s.metadata.MessageVisibilityTimeout),
|
||||
WaitTimeSeconds: int32(s.metadata.MessageWaitTimeSeconds),
|
||||
VisibilityTimeout: s.metadata.MessageVisibilityTimeout,
|
||||
WaitTimeSeconds: s.metadata.MessageWaitTimeSeconds,
|
||||
}
|
||||
|
||||
// sem is a semaphore used to control the concurrencyLimit.
|
||||
|
|
Loading…
Reference in New Issue