Merge "[impl_rabbit] Remove deprecated get_expiration method"
This commit is contained in:
commit
3b10fa8fcb
@ -33,8 +33,6 @@ import kombu.messaging
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import netutils
|
from oslo_utils import netutils
|
||||||
from oslo_utils import versionutils
|
|
||||||
import pkg_resources
|
|
||||||
import six
|
import six
|
||||||
from six.moves.urllib import parse
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
@ -1143,18 +1141,6 @@ class Connection(object):
|
|||||||
with self._connection_lock:
|
with self._connection_lock:
|
||||||
self.ensure(method, retry=retry, error_callback=_error_callback)
|
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):
|
def _publish(self, exchange, msg, routing_key=None, timeout=None):
|
||||||
"""Publish a message."""
|
"""Publish a message."""
|
||||||
|
|
||||||
@ -1174,7 +1160,7 @@ class Connection(object):
|
|||||||
self._producer.publish(msg,
|
self._producer.publish(msg,
|
||||||
exchange=exchange,
|
exchange=exchange,
|
||||||
routing_key=routing_key,
|
routing_key=routing_key,
|
||||||
expiration=self._get_expiration(timeout),
|
expiration=timeout,
|
||||||
compression=self.kombu_compression)
|
compression=self.kombu_compression)
|
||||||
|
|
||||||
def _publish_and_creates_default_queue(self, exchange, msg,
|
def _publish_and_creates_default_queue(self, exchange, msg,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user