Use monkeypatch to allow multithreaded prod flask
Without this tasks were blocking when other task were active (for instance, any task with --wait). Using the moneypatch, these no longer block.
This commit is contained in:
parent
65b44f2955
commit
973c78b8e0
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
import gevent.pywsgi
|
import gevent.pywsgi
|
||||||
import pvcapid.flaskapi as pvc_api
|
import pvcapid.flaskapi as pvc_api
|
||||||
|
from gevent import monkey
|
||||||
|
|
||||||
##########################################################
|
##########################################################
|
||||||
# Entrypoint
|
# Entrypoint
|
||||||
|
@ -30,6 +31,7 @@ if pvc_api.config['debug']:
|
||||||
# Run in Flask standard mode
|
# Run in Flask standard mode
|
||||||
pvc_api.app.run(pvc_api.config['listen_address'], pvc_api.config['listen_port'])
|
pvc_api.app.run(pvc_api.config['listen_address'], pvc_api.config['listen_port'])
|
||||||
else:
|
else:
|
||||||
|
monkey.patch_all()
|
||||||
if pvc_api.config['ssl_enabled']:
|
if pvc_api.config['ssl_enabled']:
|
||||||
# Run the WSGI server with SSL
|
# Run the WSGI server with SSL
|
||||||
http_server = gevent.pywsgi.WSGIServer(
|
http_server = gevent.pywsgi.WSGIServer(
|
||||||
|
|
Loading…
Reference in New Issue