Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to allow long running request not block everything else #62

Closed
valgog opened this issue Sep 14, 2015 · 6 comments
Closed

Comments

@valgog
Copy link

valgog commented Sep 14, 2015

Now per default the long running request is blocking all other requests. This is an issue of Flask, but still would make sense to document.

Here is an example from Henning's email:

#!/usr/bin/env python3                                                                                                                                                                                                                       

import gevent.monkey

gevent.monkey.patch_all()  # CHANGED!

import connexion
import flask
from time import sleep

def get_greeting():

    def generator():
        while True:
            yield "beat\n\n"
            sleep(5)

    response = flask.Response(generator(), mimetype='text/plain', status=200)
    return response

if __name__ == '__main__':
    app = connexion.App(__name__, 8080, server='gevent')  # CHANGED!
    app.add_api('helloworld-api.yaml', arguments={'title': 'Hello World Example'})
    app.run()
@hjacobs
Copy link
Contributor

hjacobs commented Sep 14, 2015

Yes, not specifying the server will run Flask with the Werkzeug development HTTP server --- which is not meant for production usage.

You can either run Connexion with gevent, Tornado or some WSGI container (not tested, see #54).

@jmcs jmcs closed this as completed Sep 21, 2015
@hjacobs
Copy link
Contributor

hjacobs commented Sep 21, 2015

I'm reopening this issue as the mentioned behavior (gevent monkey patch, uWSGI, etc) is not yet fully documented (in README or connexion.readthedocs.org).

@hjacobs hjacobs reopened this Sep 21, 2015
@hjacobs
Copy link
Contributor

hjacobs commented Sep 21, 2015

This is not really an issue of Connexion, but we should make it easy for people without prior Python/Flask/WSGI knowledge 😄

@rafaelcaricio
Copy link
Collaborator

Does it covers what is expected by this issue?

@rafaelcaricio
Copy link
Collaborator

Closing this issue, we have info about that in the README

@funseiki
Copy link

funseiki commented Aug 4, 2016

This makes sense for the gevent lib, since the corresponding libraries are patched. How does this work with something like tornado, where we must yield a Future object?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants