← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/launchpad/longpoll-autodelete-5minutes into lp:launchpad

 

Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/longpoll-autodelete-5minutes into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~rvb/launchpad/longpoll-autodelete-5minutes/+merge/77538

This branches adds the proper options to channel.queue_declare so that each created queue will be deleted after 5 minutes of inactivity (as opposed to "as soon as the queue as no consumer").  This will allow the longpoll Javascript client to reconnect when the first message has been received.  (And yes, auto_deleted=False, arguments={"x-expires": 300000} means that the queue will be auto_deleted, only using a RabbitMQ-specific capability and not the standard amqp 'auto_delete' option).
-- 
https://code.launchpad.net/~rvb/launchpad/longpoll-autodelete-5minutes/+merge/77538
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/longpoll-autodelete-5minutes into lp:launchpad.
=== modified file 'lib/lp/services/messaging/rabbit.py'
--- lib/lp/services/messaging/rabbit.py	2011-09-26 20:27:04 +0000
+++ lib/lp/services/messaging/rabbit.py	2011-09-29 14:14:09 +0000
@@ -232,7 +232,9 @@
     def __init__(self, session, name):
         super(RabbitQueue, self).__init__(session)
         self.name = name
-        self.channel.queue_declare(self.name, nowait=False)
+        self.channel.queue_declare(
+            self.name, nowait=False, auto_delete=False,
+            arguments={"x-expires": 300000})  # 5 minutes.
 
     def receive(self, timeout=0.0):
         """Pull a message from the queue.