diff --git a/celery/__init__.py b/celery/__init__.py index d249e49278b..f0bb063f0d7 100644 --- a/celery/__init__.py +++ b/celery/__init__.py @@ -10,6 +10,10 @@ from __future__ import absolute_import, print_function, unicode_literals +import gevent +from gevent import monkey, signal as gevent_signal +monkey.patch_all() + import os import re import sys @@ -113,10 +117,13 @@ def _patch_eventlet(): def _patch_gevent(): - import gevent - from gevent import monkey, signal as gevent_signal - - monkey.patch_all() + # Moved to the top of this file + # by Tei + # + # import gevent + # from gevent import monkey, signal as gevent_signal + # + # monkey.patch_all() if gevent.version_info[0] == 0: # pragma: no cover # Signals aren't working in gevent versions <1.0, # and aren't monkey patched by patch_all()