From 034c8f03aa625a4f93e3b1f516686b53f5c81380 Mon Sep 17 00:00:00 2001 From: Kirill Bespalov Date: Tue, 31 May 2016 13:44:36 +0300 Subject: [PATCH] [impl_rabbit] Remove deprecated get_expiration method This method is called on each message publishing and as shows profiling (CProfile), the method is time-consuming, because it uses pkg_resources module. As we uses kombu>=3.0.25 since Mitaka, we no longer need in it. Change-Id: I00723a3de81249946a8220ad47129f059d6d544f --- oslo_messaging/_drivers/impl_rabbit.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/oslo_messaging/_drivers/impl_rabbit.py b/oslo_messaging/_drivers/impl_rabbit.py index fcfabfdf1..9c44465d0 100644 --- a/oslo_messaging/_drivers/impl_rabbit.py +++ b/oslo_messaging/_drivers/impl_rabbit.py @@ -33,8 +33,6 @@ import kombu.messaging from oslo_config import cfg from oslo_log import log as logging from oslo_utils import netutils -from oslo_utils import versionutils -import pkg_resources import six from six.moves.urllib import parse @@ -1143,18 +1141,6 @@ class Connection(object): with self._connection_lock: self.ensure(method, retry=retry, error_callback=_error_callback) - def _get_expiration(self, timeout): - # NOTE(gcb) kombu accept TTL as seconds instead of millisecond since - # version 3.0.25, so do conversion according to kombu version. - # TODO(gcb) remove this workaround when all supported branches - # with requirement kombu >=3.0.25 - if timeout is not None: - kombu_version = pkg_resources.get_distribution('kombu').version - if not versionutils.is_compatible('3.0.25', kombu_version): - timeout = int(timeout * 1000) - - return timeout - def _publish(self, exchange, msg, routing_key=None, timeout=None): """Publish a message.""" @@ -1174,7 +1160,7 @@ class Connection(object): self._producer.publish(msg, exchange=exchange, routing_key=routing_key, - expiration=self._get_expiration(timeout), + expiration=timeout, compression=self.kombu_compression) def _publish_and_creates_default_queue(self, exchange, msg,