rabbit: move stdlib_threading bits into _utils
The amqp1 driver also needs this same logic, so split it out and share it. Change-Id: I2e9dbfa27887e26807f199c9d359bacd7c15c67a
This commit is contained in:
parent
d4f7ea21fc
commit
ca939fc0e4
@ -35,7 +35,6 @@ import kombu.messaging
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import eventletutils
|
||||
from oslo_utils import importutils
|
||||
|
||||
import oslo_messaging
|
||||
from oslo_messaging._drivers import amqp as rpc_amqp
|
||||
@ -46,18 +45,6 @@ from oslo_messaging._drivers import pool
|
||||
from oslo_messaging import _utils
|
||||
from oslo_messaging import exceptions
|
||||
|
||||
eventlet = importutils.try_import('eventlet')
|
||||
if eventlet and eventletutils.is_monkey_patched("thread"):
|
||||
# Here we initialize module with the native python threading module
|
||||
# if it was already monkey patched by eventlet/greenlet.
|
||||
stdlib_threading = eventlet.patcher.original('threading')
|
||||
else:
|
||||
# Manage the case where we run this driver in a non patched environment
|
||||
# and where user even so configure the driver to run heartbeat through
|
||||
# a python thread, if we don't do that when the heartbeat will start
|
||||
# we will facing an issue by trying to override the threading module.
|
||||
stdlib_threading = threading
|
||||
|
||||
# NOTE(sileht): don't exist in py2 socket module
|
||||
TCP_USER_TIMEOUT = 18
|
||||
|
||||
@ -517,7 +504,7 @@ class Connection(object):
|
||||
# threading module with the native python threading module
|
||||
# if it was already monkey patched by eventlet/greenlet.
|
||||
global threading
|
||||
threading = stdlib_threading
|
||||
threading = _utils.stdlib_threading
|
||||
|
||||
self.direct_mandatory_flag = driver_conf.direct_mandatory_flag
|
||||
|
||||
|
@ -14,11 +14,25 @@
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import threading
|
||||
|
||||
from oslo_utils import eventletutils
|
||||
from oslo_utils import importutils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
eventlet = importutils.try_import('eventlet')
|
||||
if eventlet and eventletutils.is_monkey_patched("thread"):
|
||||
# Here we initialize module with the native python threading module
|
||||
# if it was already monkey patched by eventlet/greenlet.
|
||||
stdlib_threading = eventlet.patcher.original('threading')
|
||||
else:
|
||||
# Manage the case where we run this driver in a non patched environment
|
||||
# and where user even so configure the driver to run heartbeat through
|
||||
# a python thread, if we don't do that when the heartbeat will start
|
||||
# we will facing an issue by trying to override the threading module.
|
||||
stdlib_threading = threading
|
||||
|
||||
|
||||
def version_is_compatible(imp_version, version):
|
||||
"""Determine whether versions are compatible.
|
||||
|
Loading…
Reference in New Issue
Block a user