diff --git a/oslo_messaging/_drivers/impl_rabbit.py b/oslo_messaging/_drivers/impl_rabbit.py index 1f75b3349..26f917377 100644 --- a/oslo_messaging/_drivers/impl_rabbit.py +++ b/oslo_messaging/_drivers/impl_rabbit.py @@ -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 diff --git a/oslo_messaging/tests/drivers/test_impl_rabbit.py b/oslo_messaging/tests/drivers/test_impl_rabbit.py index c2efb27a4..7d14d2857 100644 --- a/oslo_messaging/tests/drivers/test_impl_rabbit.py +++ b/oslo_messaging/tests/drivers/test_impl_rabbit.py @@ -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):