Sorry I send the message without finishing.  I am confused of the yield for
such a simple example is required for the gevent loop or if the use of the
return will now block...

I understand that if I want to do post processing after I write data to the
client I would yield but if no post  processing does the return block the
IO Loop?

thanks


On Tue, Sep 2, 2014 at 9:51 PM, David Montgomery <[email protected]>
wrote:

>
>
> from gevent import monkey; monkey.patch_all()
> from flask import render_template
> from flask import Response
> from app import app
> import urllib2
>
> def fetch_url(url):
>    response = urllib2.urlopen('http://python.org/'
>    html = response.read()
>
> @app.route("/test")
> def test():
>     jt=gevent.spawn(fetch_url)
>     jt.join()
>     return "Hello World"
>
>
> Or do I have to
>
>
> @app.route("/test")
>
> def test():
>     jt=gevent.spawn(fetch_url)
>     jt.join()
>
>         def generate():
>               yield "hello world"
>         return Response(generate())
>
>
> I would like the call to the urllib2 to by async
>
>
>
>
>
>
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to