Merge "rabbit: fix unit conversion error of expiration"
This commit is contained in:
commit
7cb3314133
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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user