summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Shepelev <temotor@gmail.com>2017-09-07 09:27:54 +0300
committerSergey Shepelev <temotor@gmail.com>2017-09-07 09:28:56 +0300
commit82f1877ff5b950e1ee9debbb8be880ebedb8abcb (patch)
tree2ec66c8c561dd28460c972e72ab7bc62d52031cf
parentb756447bab51046dfc6f1e0e299cc997ab343701 (diff)
downloadeventlet-82f1877ff5b950e1ee9debbb8be880ebedb8abcb.tar.gz
init: second workaround for monotonic "no suitable implementation"; Thanks to Geoffrey Thomasmonotonic-401
Force sooner find_library child process by early import monotonic. Helps with gunicorn and possibly other applications. https://github.com/eventlet/eventlet/issues/401 https://github.com/benoitc/gunicorn/issues/1584
-rw-r--r--eventlet/__init__.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/eventlet/__init__.py b/eventlet/__init__.py
index 9da3cfd..fd50869 100644
--- a/eventlet/__init__.py
+++ b/eventlet/__init__.py
@@ -17,6 +17,12 @@ if os.environ.get('EVENTLET_IMPORT_VERSION_ONLY') != '1':
from eventlet import support
from eventlet import timeout
import greenlet
+ # Force monotonic library search as early as possible.
+ # Helpful when CPython < 3.5 on Linux blocked in `os.waitpid(-1)` before first use of hub.
+ # Example: gunicorn
+ # https://github.com/eventlet/eventlet/issues/401#issuecomment-327500352
+ from eventlet.support import monotonic
+ del monotonic
connect = convenience.connect
listen = convenience.listen
@@ -58,3 +64,5 @@ if os.environ.get('EVENTLET_IMPORT_VERSION_ONLY') != '1':
('exc_after', 'greenthread.exc_after', greenthread.exc_after),
('call_after_global', 'greenthread.call_after_global', greenthread.call_after_global),
))
+
+del os