Monkey patch eventlet

This commit is contained in:
datalets 2021-05-16 01:22:59 +02:00
parent 5f5d1b5e93
commit ad3457f133
5 changed files with 19 additions and 3 deletions

View File

@ -1,3 +1,3 @@
web: gunicorn --config=gunicorn.conf.py dribdat.app:init_app\(\)
web: gunicorn --config=gunicorn.conf.py patched:init_app\(\)
default: gunicorn dribdat.app:init_app\(\) -b 0.0.0.0:$DEFAULT_PORT -w 3 --log-file=-
release: ./release.sh

View File

@ -8,4 +8,5 @@ secure_scheme_headers = {
}
bind = '0.0.0.0:%s' % str(os_env.get('PORT', 5000))
worker_class = 'eventlet'
workers = os_env.get('WORKERS', 2)
errorlog = '-'

15
patched.py Normal file
View File

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
"""Monkey patched application for workers."""
try:
from eventlet import monkey_patch as monkey_patch
monkey_patch()
except ImportError:
try:
from gevent.monkey import patch_all
patch_all()
from psycogreen.gevent import patch_psycopg
patch_psycopg()
except ImportError:
pass
from dribdat.app import init_app # re-export

View File

@ -11,7 +11,7 @@ click = ">=6.7"
cssmin = ">=0.2.0"
email_validator = ">=1.1.1"
email-validator = "*"
eventlet = ">=0.30.2"
eventlet = "0.30.2"
flask = ">=0.12.2"
flask-assets = ">=0.12"
flask-bcrypt = ">=0.7.1"

View File

@ -11,7 +11,7 @@ chardet==4.0.0
Click>=8.0.0,<9
cssmin==0.2.0
cssselect==1.1.0
eventlet==0.31.0
eventlet==0.30.2
Flask==1.1.2
Flask-Assets==2.0
Flask-Bcrypt==0.7.1