From 5cb7b62342c9876fba0e3ef7c62fe6673ca755c3 Mon Sep 17 00:00:00 2001 From: Matt Mullins Date: Tue, 19 May 2015 21:31:25 -0700 Subject: [PATCH] amqp: set the auto_delete bit on queues. Without this, AMQP queues are leaked whenever we reconnect to an ircd. Exclusive queues are only deleted when the connection is torn-down; auto-deleted queues are also deleted when the last (i.e. only in this case) conusmer is removed. Since the AMQP consumers are tied to processes running under the irc_object_sup for the IRC connection, these will be torn-down when we reconnect to the ircd. --- amqp/amqp_bot_listener.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amqp/amqp_bot_listener.erl b/amqp/amqp_bot_listener.erl index a0732b3..829d147 100644 --- a/amqp/amqp_bot_listener.erl +++ b/amqp/amqp_bot_listener.erl @@ -30,7 +30,7 @@ listen_for_events(RoutingKeyString) -> type = <<"topic">> }), #'queue.declare_ok'{ queue = Queue } = amqp_channel:call(Channel, - #'queue.declare'{ exclusive = true }), + #'queue.declare'{ exclusive = true, auto_delete = true }), #'queue.bind_ok'{} = amqp_channel:call(Channel, #'queue.bind'{ exchange = ?EXCHANGE, queue = Queue, -- 2.11.0