Delay queue creation if we're not connected in the TornadoQueueClient

(imported from commit c583693783322136927ae1a1018a61b2ffa6597f)
This commit is contained in:
Leo Franchi
2013-04-16 10:01:18 -04:00
parent befe7c26d3
commit 79a94a8e79

View File

@@ -151,8 +151,13 @@ class TornadoQueueClient(SimpleQueueClient):
callback() callback()
if queue_name not in self.queues: if queue_name not in self.queues:
self.channel.queue_declare(queue=queue_name, durable=True, # If we're not connected yet, send this message
callback=finish) # once we have created the channel
if not self.ready():
self._on_open_cbs.append(lambda: self.ensure_queue(queue_name, callback))
return
self.channel.queue_declare(queue=queue_name, durable=True, callback=finish)
else: else:
callback() callback()