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
This commit is contained in:
Mark McLoughlin 2013-07-31 08:04:11 +01:00
parent 1f0874857c
commit 8b366b3001
2 changed files with 1 additions and 4 deletions

View File

@ -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:

View File

@ -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'})