Monkey patch original current_thread _active

Monkey patch the original current_thread to use the up-to-date _active
global variable. This solution is based on that documented at:
https://github.com/eventlet/eventlet/issues/592

Change-Id: Ia2dd231f4b8cb6f8876cf54671529095a9d11fc6
Closes-Bug: #1863021
This commit is contained in:
Chris MacNaughton 2020-05-06 08:16:15 +02:00
parent 1472b8d077
commit e03968b46c

View File

@ -14,6 +14,13 @@ from neutron.common import eventlet_utils
eventlet_utils.monkey_patch()
# Monkey patch the original current_thread to use the up-to-date _active
# global variable. See https://bugs.launchpad.net/bugs/1863021 and
# https://github.com/eventlet/eventlet/issues/592
import __original_module_threading as orig_threading # noqa
import threading # noqa
orig_threading.current_thread.__globals__['_active'] = threading._active
import os # noqa
NSX_EXT_PATH = os.path.join(os.path.dirname(__file__), 'extensions')