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
Support async / await #241
Comments
100% agree, adding this to the roadmap for 3.0.0 Thanks! ~Timothy |
Is the plan to fully support async requests or simply coroutines that would use async functionalities? |
It seems like hug does not support async? Because server always wait the run_until_complete over and starting receiving next request, quite weird to me. hug's server log Serving on port 8001... foo 127.0.0.1 - - [03/Apr/2016 23:48:14] "GET /public HTTP/1.1" 200 62 foo 127.0.0.1 - - [03/Apr/2016 23:48:14] "GET /public HTTP/1.1" 200 62 foo 127.0.0.1 - - [03/Apr/2016 23:48:14] "GET /public HTTP/1.1" 200 62 foo 127.0.0.1 - - [03/Apr/2016 23:48:14] "GET /public HTTP/1.1" 200 62 foo 127.0.0.1 - - [03/Apr/2016 23:48:15] "GET /public HTTP/1.1" 200 62 foo 127.0.0.1 - - [03/Apr/2016 23:48:15] "GET /public HTTP/1.1" 200 62 foo 127.0.0.1 - - [03/Apr/2016 23:48:15] "GET /public HTTP/1.1" 200 62 foo
However, when using tornado , i got log like this, which can receive request asynchronously. [I 160403 23:55:15 web:1946] 200 GET / (127.0.0.1) 1198.95ms [I 160403 23:55:15 web:1946] 200 GET / (127.0.0.1) 1198.73ms [I 160403 23:55:15 web:1946] 200 GET / (127.0.0.1) 1198.42ms [I 160403 23:55:15 web:1946] 200 GET / (127.0.0.1) 1198.22ms [I 160403 23:55:15 web:1946] 200 GET / (127.0.0.1) 1198.17ms foo foo [I 160403 23:55:15 web:1946] 200 GET / (127.0.0.1) 1135.65ms [I 160403 23:55:15 web:1946] 200 GET / (127.0.0.1) 1135.08ms foo foo
|
You are right. Hug runs the falcon framework under a wsgi server which is not async compatible. I am currently looking at some design that could make it support asynchronous methods. |
@rodcloutier @timothycrosley any progress on asynchronous requests? |
Hi, @timothycrosley , I moved your code from falcon to aiohttp to achieve non-blocking IO, proved to be workable. git clone https://github.com/zhwei820/aio_hug clone aio_hug && cd aio_hug Open http://localhost:8000/v2/hello with two DIFFERENT browser, you can see 2 long request do not impact each other. |
Is this going to be merged into master? |
There is a related issue on falcon: falconry/falcon#1008 |
Any progress on this? |
It would be nice if you could register coroutines or async functions as api endpoints. Currently I am using async but each endpoint is responsible for managing the event loop. So for now I have something like:
Instead I would prefer the following to be allowed:
The text was updated successfully, but these errors were encountered: