From 68dd0e8620061ac1af95e20af250bb0349254410 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Thu, 7 May 2020 03:25:39 +0000 Subject: [PATCH] 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: Ib33e812cacf96c560fce32c0af43d74ac1074ee1 --- zun/cmd/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zun/cmd/__init__.py b/zun/cmd/__init__.py index 277b2af39..15fc6bfa7 100644 --- a/zun/cmd/__init__.py +++ b/zun/cmd/__init__.py @@ -18,3 +18,9 @@ import eventlet 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