I have a monkey patched flask api with gevent that does not seem to process requests in parallel.
tested with gevent version = 1.4.0; python 2.7 and python 3.7
(I also tried with gevent.sleep
, still does not work)
from gevent import monkey
monkey.patch_all()
from flask import Flask
from gevent.pywsgi import WSGIServer
import gevent
import time
app = Flask(__name__)
@app.route('/')
def overview():
print('1')
time.sleep(10)
print('2')
return "ok"
WSGIServer(('', 3341), app).serve_forever()
Output for two requests sent via different tabs in browser:
1
2
::1 - - [2020-01-09 16:51:42] "GET / HTTP/1.1" 200 117 10.006179
1
2
::1 - - [2020-01-09 16:51:52] "GET / HTTP/1.1" 200 117 10.005313
shows that the server is processing requests sequentially.
Thanks for helping.