rabbit: fix unit conversion error of expiration

kombu has already made a conversion from seconds to milliseconds,
so we do not need to do it again.

Closes-Bug: #1531148
Change-Id: Ia4478f15f1980a93a53f7e1e6570f68aeec75c69
This commit is contained in:
Javeme 2016-01-05 20:05:10 +08:00
parent 7c723afd0a
commit d49ddc3b98
2 changed files with 2 additions and 8 deletions
oslo_messaging

@ -976,12 +976,6 @@ class Connection(object):
channel=self.channel,
routing_key=routing_key)
expiration = None
if timeout:
# AMQP TTL is in milliseconds when set in the property.
# Details: http://www.rabbitmq.com/ttl.html#per-message-ttl
expiration = int(timeout * 1000)
# NOTE(sileht): no need to wait more, caller expects
# a answer before timeout is reached
transport_timeout = timeout
@ -1001,7 +995,7 @@ class Connection(object):
LOG.trace('Connection._publish: sending message %(msg)s to'
' %(who)s with routing key %(key)s', log_info)
with self._transport_socket_timeout(transport_timeout):
producer.publish(msg, expiration=expiration)
producer.publish(msg, expiration=timeout)
# List of notification queue declared on the channel to avoid
# unnecessary redeclaration. This list is resetted each time

@ -180,7 +180,7 @@ class TestRabbitPublisher(test_utils.BaseTestCase):
conn = pool_conn.connection
conn._publish(mock.Mock(), 'msg', routing_key='routing_key',
timeout=1)
fake_publish.assert_called_with('msg', expiration=1000)
fake_publish.assert_called_with('msg', expiration=1)
@mock.patch('kombu.messaging.Producer.publish')
def test_send_no_timeout(self, fake_publish):