From: Matt Mullins Date: Wed, 20 May 2015 04:31:25 +0000 (-0700) Subject: amqp: set the auto_delete bit on queues. X-Git-Tag: v15~8 X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=5cb7b62342c9876fba0e3ef7c62fe6673ca755c3;p=erlbot.git 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. --- 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,