Fix- Raise InvalidParameterValue when change visibility timeout is mo… (#3893)

* Fix- Raise InvalidParameterValue when change visibility timeout is more than permitted

* Fix review comments

* Modified tests

* Fix tests

* change

* Change client

* Fix tests

* fix tests

* fix tests

* change tests

* Fix tests

* changed tests

* Fix tests

* Fix tests

* Change message
This commit is contained in:
usmangani1 2021-05-18 12:19:56 +05:30 committed by GitHub
commit abc62b360d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 1 deletions

View file

@ -887,6 +887,17 @@ class SQSBackend(BaseBackend):
if message.receipt_handle == receipt_handle:
if message.visible:
raise MessageNotInflight
visibility_timeout_msec = int(visibility_timeout) * 1000
given_visibility_timeout = unix_time_millis() + visibility_timeout_msec
if given_visibility_timeout - message.sent_timestamp > 43200 * 1000:
raise InvalidParameterValue(
"Value {0} for parameter VisibilityTimeout is invalid. Reason: Total "
"VisibilityTimeout for the message is beyond the limit [43200 seconds]".format(
visibility_timeout
)
)
message.change_visibility(visibility_timeout)
if message.visible:
# If the message is visible again, remove it from pending