Page MenuHomeDevCentral

D999.diff
No OneTemporary

D999.diff

diff --git a/app.py b/app.py
--- a/app.py
+++ b/app.py
@@ -131,9 +131,21 @@
channel = connection.channel()
channel.queue_declare(durable=True,
queue=queue_name)
- channel.queue_bind(exchange=exchange_name,
- queue=queue_name,
- routing_key=routing_key)
+ try:
+ channel.queue_bind(exchange=exchange_name,
+ queue=queue_name,
+ routing_key=routing_key)
+ except pika.exceptions.ChannelClosed as err:
+ # We've created a queue but we can't use it,
+ # so let's try to delete it through a new connection.
+ try:
+ print("Deleting unused queue: {0}".format(queue_name))
+ delete_broker_queue(queue_name, True)
+ except pika.exceptions.ChannelClosed:
+ pass
+
+ raise err
+
connection.close(reply_text="Operation done")
return queue_key

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 20, 00:41 (22 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2253140
Default Alt Text
D999.diff (962 B)

Event Timeline