Alex Schokking
Alex Schokking

Reputation: 674

Why would SQS fail to set a VisibilityTimeout of 43199 when the max is stated as 43200?

Recently needed to set some really long timeouts on SQS messages and saw that the documented limit was 12 hours (43200). So I tried setting the timeout to 1s under that and got this error back that sounds crazy (in that 43199 is in fact less than 43200 in most number systems).

SQSError: SQSError: 400 Bad Request SenderInvalidParameterValueValue 43199 for parameter VisibilityTimeout is invalid. Reason: Total VisibilityTimeout for the message is beyond the limit [43200 seconds]

Anyone have any ideas?

EDIT: Looks like it was the concept of 'Total' timeout being different from what the timeout I was setting with the change_visibility API call. The Total is ticking from when the message was first received

Upvotes: 9

Views: 3436

Answers (2)

Lubo Sach
Lubo Sach

Reputation: 593

It looks like you were setting message visibility with ChangeMessageVisibility API on message which were already received at that moment and not visible.

Visibility timeout is 12 hour for message in total. It means that when you receive message, visibility timeout is already running for this message. When you call ChangeMessageVisibility you can increase visibility timeout only with value which will not breach 12 hours in total with already elapsed visibility timeout.

Upvotes: 17

Naveen Vijay
Naveen Vijay

Reputation: 16482

I am not sure why you are getting error if you specify the value as 43199 but I just tried to create a queue in AWS Console with 12 hours as the Default Visibility timeout.

AWS Console

Edit :

I tried to set the visibility timeout via. CLI as 43199 seconds and it succeeded as well - I think it must be an interim issue, please try again.

aws sqs set-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/12345677/test --attributes VisibilityTimeout=43199

CLI AWS SQS

Upvotes: 0

Related Questions