diff --git a/st2api/st2api/app.py b/st2api/st2api/app.py index 396fa3bf54..d26f257435 100644 --- a/st2api/st2api/app.py +++ b/st2api/st2api/app.py @@ -14,9 +14,7 @@ # limitations under the License. import os -import sys -import eventlet import pecan from oslo_config import cfg from pecan.middleware.static import StaticFileMiddleware @@ -24,6 +22,7 @@ from st2api import config as st2api_config from st2common import hooks from st2common import log as logging +from st2common.util.monkey_patch import monkey_patch from st2common.constants.system import VERSION_STRING from st2common.service_setup import setup as common_setup @@ -57,12 +56,7 @@ def setup_app(config=None): # Note: We need to perform monkey patching in the worker. If we do it in # the master process (gunicorn_config.py), it breaks tons of things # including shutdown - eventlet.monkey_patch( - os=True, - select=True, - socket=True, - thread=False if '--use-debugger' in sys.argv else True, - time=True) + monkey_patch() st2api_config.register_opts() # This should be called in gunicorn case because we only want diff --git a/st2auth/st2auth/app.py b/st2auth/st2auth/app.py index 27a7f9a930..419ee01b08 100644 --- a/st2auth/st2auth/app.py +++ b/st2auth/st2auth/app.py @@ -13,15 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys - -import eventlet import pecan from oslo_config import cfg from st2auth import config as st2auth_config from st2common import hooks from st2common import log as logging +from st2common.util.monkey_patch import monkey_patch from st2common.constants.system import VERSION_STRING from st2common.service_setup import setup as common_setup @@ -50,12 +48,7 @@ def setup_app(config=None): # Note: We need to perform monkey patching in the worker. If we do it in # the master process (gunicorn_config.py), it breaks tons of things # including shutdown - eventlet.monkey_patch( - os=True, - select=True, - socket=True, - thread=False if '--use-debugger' in sys.argv else True, - time=True) + monkey_patch() # This should be called in gunicorn case because we only want # workers to connect to db, rabbbitmq etc. In standalone HTTP diff --git a/st2stream/st2stream/app.py b/st2stream/st2stream/app.py index 83c368f83a..3cede680c2 100644 --- a/st2stream/st2stream/app.py +++ b/st2stream/st2stream/app.py @@ -23,15 +23,14 @@ """ import os -import sys -import eventlet import pecan from oslo_config import cfg from st2stream import config as st2stream_config from st2common import hooks from st2common import log as logging +from st2common.util.monkey_patch import monkey_patch from st2common.constants.system import VERSION_STRING from st2common.service_setup import setup as common_setup @@ -58,12 +57,10 @@ def setup_app(config=None): is_gunicorn = getattr(config, 'is_gunicorn', False) if is_gunicorn: - eventlet.monkey_patch( - os=True, - select=True, - socket=True, - thread=False if '--use-debugger' in sys.argv else True, - time=True) + # Note: We need to perform monkey patching in the worker. If we do it in + # the master process (gunicorn_config.py), it breaks tons of things + # including shutdown + monkey_patch() st2stream_config.register_opts() # This should be called in gunicorn case because we only want