Permalink
Browse files

gevent: set env var GEVENT_MONKEY_PATCH=1 in uwsgi.ini to enable monk…

…ey-patching explicitly in pywb.apps.wayback
  • Loading branch information...
1 parent 63f44cb commit 1a458d6b2690a0b411709c1180c49e671a00067c @ikreymer committed Mar 21, 2016
Showing with 9 additions and 8 deletions.
  1. +4 −3 CHANGES.rst
  2. +0 −3 pywb/apps/conftest.py
  3. +3 −2 pywb/apps/wayback.py
  4. +2 −0 uwsgi.ini
View
@@ -1,11 +1,12 @@
pywb 0.11.4 changelist
~~~~~~~~~~~~~~~~~~~~~~
-* wombat: overrides ``window.crypto.getRandomValues()`` to use predictable random for improved
+* wombat: overrides ``window.crypto.getRandomValues()`` to use predictable 'random' values for improved
replayability in many JS applications.
-* fix gevent/uwsgi: add ``gevent.monkey.patch_all()`` to ``pywb.apps.wayback`` used by ``uwsgi.ini``.
- (Was relying on ``gevent-early-monkey-patch`` which is not yet available until uwsgi 2.1).
+* fix gevent/uwsgi: run ``gevent.monkey.patch_all()`` explicitly when loading ``pywb.apps.wayback`` if ``GEVENT_MONKEY_PATCH=1`` env var is set
+
+ Enabled by default in ``uwsgi.ini``. (Was previously relying on ``gevent-early-monkey-patch`` which is not yet available until uwsgi 2.1 is released).
pywb 0.11.3 changelist
@@ -1,3 +0,0 @@
-def pytest_configure(config):
- import sys
- sys._called_from_test = True
@@ -1,9 +1,10 @@
-import sys
+import os
-if not hasattr(sys, '_called_from_test'): #pragma: no cover
+if os.environ.get('GEVENT_MONKEY_PATCH') == '1': #pragma: no cover
# Use gevent if available
try:
from gevent.monkey import patch_all; patch_all()
+ print('gevent patched!')
except Exception as e:
pass
View
@@ -16,6 +16,8 @@ gevent = 100
#Not available until uwsgi 2.1
#monkey-patching manually in pywb.apps.wayback
#gevent-early-monkey-patch =
+# for uwsgi<2.1, set env when using gevent
+env = GEVENT_MONKEY_PATCH=1
# specify config file here
env = PYWB_CONFIG_FILE=config.yaml

0 comments on commit 1a458d6

Please sign in to comment.