kombu/t
Tom Sparrow 5062d53f94
SQS: avoid excessive GetQueueURL calls by using cached queue url (#1621)
* Fix #1618: avoid re-fetching queue URL when we already have it

`_get_from_sqs` was unnecessarily calling `get_queue_url` every
time even though the only place which calls `_get_from_sqs`
(that is `_get_async`) actually already knows the queue URL.

This change avoids hundreds of `GetQueueUrl` AWS API calls per hour
when using this SQS backend with celery.

Also `connection` is set by the one-and-only caller (and `queue` is
actually the queue name string now anyway so couldn't ever have
`.connection`) so remove the None default and unused fallback code.

* Clarify that `_new_queue` returns the queue URL

It seems that prior to 129a9e4ed0 it returned a queue
object but this is no longer the case so update comments
variable names accordingly to make it clearer.

Also remove the incorrect fallback which cannot
be correct any more given the return value has to
be the queue URL which must be a string.

* Unit test coverage for SQS async codepath

This key code path (which as far as I can see is
the main route when using celery with SQS) was
missing test coverage.

This test adds coverage for:
`_get_bulk_async` -> `_get_async` -> `_get_from_sqs`
2023-04-19 10:01:07 +06:00
..
integration Fix incompatibility with redis in disconnect() (#1589) 2022-08-25 23:47:52 +06:00
unit SQS: avoid excessive GetQueueURL calls by using cached queue url (#1621) 2023-04-19 10:01:07 +06:00
__init__.py Rewrite tests to use py.test 2016-08-23 11:38:54 -07:00
mocks.py Add separate transport option for retry loop timeout (#1599) 2022-10-12 19:41:04 +06:00
skip.py Bump pyupgrade version and add __future__.annotations import 2022-04-15 14:16:57 +06:00