summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2013-07-31 08:04:11 +0100
committerMark McLoughlin <markmc@redhat.com>2013-08-02 06:48:01 +0100
commit8b366b300133e13d933e93490debb09e6f362899 (patch)
treede8d2ef7e62e8d12256090a7e1f5ff6a537c6f1e
parent1f0874857ce322edc1fac6d3d6301a8869e79c4c (diff)
downloadoslo-messaging-8b366b300133e13d933e93490debb09e6f362899.tar.gz
Pop _unique_id when checking for duplicates
Drivers should not be returning messages with any driver-specific wire format fields included. Right now, the rabbit and qpid drivers are leaking the _unique_id field. Avoid this simply by popping _unique_id when we're checking for dups. Change-Id: Icbfb02ee66aebe5ef97a9a2502d8a0745e07bd8b
-rw-r--r--oslo/messaging/_drivers/amqp.py2
-rw-r--r--tests/test_rabbit.py3
2 files changed, 1 insertions, 4 deletions
diff --git a/oslo/messaging/_drivers/amqp.py b/oslo/messaging/_drivers/amqp.py
index 2878787..95a84f1 100644
--- a/oslo/messaging/_drivers/amqp.py
+++ b/oslo/messaging/_drivers/amqp.py
@@ -323,7 +323,7 @@ class _MsgIdCache(object):
before ack is returned. This method prevents doing it.
"""
if UNIQUE_ID in message_data:
- msg_id = message_data[UNIQUE_ID]
+ msg_id = message_data.pop(UNIQUE_ID)
if msg_id not in self.prev_msgids:
self.prev_msgids.append(msg_id)
else:
diff --git a/tests/test_rabbit.py b/tests/test_rabbit.py
index 3cb2203..e6de418 100644
--- a/tests/test_rabbit.py
+++ b/tests/test_rabbit.py
@@ -52,7 +52,4 @@ class TestRabbitDriver(test_utils.BaseTestCase):
received = listener.poll()
self.assertTrue(received is not None)
self.assertEquals(received.ctxt, {})
-
- # FIXME(markmc): this should be done by the driver
- received.message.pop('_unique_id')
self.assertEquals(received.message, {'foo': 'bar'})