Align tests with monkey patch original current_thread _active
Recent changes [1] introduced an eventlet fix to monkey patch original current_thread _active. The goal was to monkey patch the original current_thread to use the up-to-date _active global variable. This solution is based on that documented at: eventlet/eventlet#592 I think we need this patch on unit test too to ensure a consistent behavior, so these changes doing that. [1] https://review.opendev.org/#/c/725359/ Change-Id: I7b6cca86e44261bf2f953be74e9738ac09507649
This commit is contained in:
parent
38306c8319
commit
b9f8224006
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue