-
Notifications
You must be signed in to change notification settings - Fork 69
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
Async doesn't work - is sequential instead #4
Comments
@shreyabatra4 I don't know if you are the correct to tag but maybe you can't point me in the correct direction ? :-) |
@thomasfrederikhoeck we discussed this issue today and are working on a fix, we'll update the issue with some more details soon |
@tonybaloney sounds good - looking forward to hearing more! |
I saw that someone used some of the hidden functions to make it work import azure.functions as func
from azure.functions._http_asgi import AsgiResponse, AsgiRequest
from FastAPIApp import app
async def handle_asgi_request(req: func.HttpRequest, context: func.Context) -> func.HttpResponse:
asgi_request = AsgiRequest(req, context)
scope = asgi_request.to_asgi_http_scope()
asgi_response = await AsgiResponse.from_app(app, scope, req.get_body())
return asgi_response.to_func_response()
async def main(req: func.HttpRequest, context: func.Context) -> func.HttpResponse:
return await handle_asgi_request(req, context) |
Yes, we're going to implement something similar and add it to the AsgiMiddleware class. It'll have to be a new API for backward compatibility with the old one |
Issue has been patched in dev, this sample repo will be updated once the client-side package updates are rolled out. Azure/azure-functions-python-library#143 We've also added a warning for use of the existing If you want to try it out, you can pip install the branch directly from GitHub in the |
@tonybaloney nice! Thank you! As I see it also removes the need for |
This change is rolled out with azure functions version 1.12.0. Thanks @tonybaloney for the fix. |
@gavin-aguiar outstanding items
|
The change to fix this (Add async wrapper PR) generates an exception, when rolling back it does work. Does it work for you?
|
@tblatrille Which azure functions version are you using? The |
@gavin-aguiar I actually have |
@tblatrille try to update azure-functions-core-tools to latest version |
And set the environment variable |
This issue is for a: (mark with an
x
)Minimal steps to reproduce
The app doesn't handle multiple request with async. If you add a asyncio.sleep(1) like this it will only be able to handle 1 request per second.
Which is in contrast to following which can take a large amount of requests.
You can test it out with locust using the following:
locust
Any log messages given by the failure
Expected/desired behavior
OS and Version?
Versions
Mention any other details that might be useful
The text was updated successfully, but these errors were encountered: