summaryrefslogtreecommitdiff
path: root/kombu/transport/SQS.py
diff options
context:
space:
mode:
authorZach Smith <zmsmith27@gmail.com>2011-07-14 09:55:38 -0700
committerZach Smith <zmsmith27@gmail.com>2011-07-14 09:55:38 -0700
commit4d3b490e1eea8b1ac84b698f31494b17771b73d1 (patch)
tree8dce27dc8363f327545d092321de9fe891185743 /kombu/transport/SQS.py
parent8537a359f6bdc21134956e39a0e2b6782610e2d3 (diff)
downloadkombu-4d3b490e1eea8b1ac84b698f31494b17771b73d1.tar.gz
Cache existing SQS queues on startup
Diffstat (limited to 'kombu/transport/SQS.py')
-rw-r--r--kombu/transport/SQS.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/kombu/transport/SQS.py b/kombu/transport/SQS.py
index 588315ad..b115bc88 100644
--- a/kombu/transport/SQS.py
+++ b/kombu/transport/SQS.py
@@ -1,4 +1,3 @@
-
"""
kombu.transport.SQS
===================
@@ -129,6 +128,17 @@ class Channel(virtual.Channel):
_queue_cache = {}
_noack_queues = set()
+ def __init__(self, *args, **kwargs):
+ super(Channel, self).__init__(*args, **kwargs)
+
+ # SQS blows up when you try to create a new queue if one alread exists with a different
+ # visability_timeout, so this populates the queue_cache to protect from recreating
+ # queues that already exist
+
+ queues = self.sqs.get_all_queues()
+ for queue in queues:
+ self._queue_cache[queue.name] = queue
+
def basic_consume(self, queue, no_ack, *args, **kwargs):
if no_ack:
self._noack_queues.add(queue)