Merge "Align tests with monkey patch original current_thread _active"

This commit is contained in:
Zuul 2020-06-22 17:22:56 +00:00 committed by Gerrit Code Review
commit ce6262437d
2 changed files with 13 additions and 0 deletions

View File

@ -25,3 +25,10 @@ if os.name == 'nt':
eventlet.monkey_patch(os=False, thread=False)
else:
eventlet.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

View File

@ -125,6 +125,12 @@ class Server(service.ServiceBase):
def run(port_queue, workers=3, process_time=0):
eventlet.patcher.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
def hi_app(environ, start_response):
# Some requests need to take time to process so the connection