Merge "Reload oslo_context after calling monkey_patch()" into stable/queens

This commit is contained in:
Zuul 2018-08-09 20:39:21 +00:00 committed by Gerrit Code Review
commit 01103a359f
1 changed files with 8 additions and 0 deletions

View File

@ -14,6 +14,8 @@
# under the License.
import eventlet
from oslo_utils import importutils
from six.moves import reload_module
from nova import debugger
@ -22,3 +24,9 @@ if debugger.enabled():
eventlet.monkey_patch(os=False, thread=False)
else:
eventlet.monkey_patch(os=False)
# NOTE(rgerganov): oslo.context is storing a global thread-local variable
# which keeps the request context for the current thread. If oslo.context is
# imported before calling monkey_patch(), then this thread-local won't be
# green. To workaround this, reload the module after calling monkey_patch()
reload_module(importutils.import_module('oslo_context.context'))