Skip to content
Discussion options

You must be logged in to vote

@alex-r-bigelow you are using json.dumps to yield inside an async function. json.dumps is blocking, but as your function is async, it is running in the main loop, so it might be blocking your app.

Don't use async, use a normal function that returns a normal iterator.

In the latest versions, StreamingResponse can take a normal generator (not only an async generator).

That might solve your problem.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
Converted from issue

This discussion was converted from issue #334 on February 28, 2023 12:21.