-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
🐛 Fix support for StreamingResponses with dependencies with yield or UploadFiles, close after the response is done
#14099
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
Conversation
…endencies with yield
…d, as those caused memory issues before
…rated background tasks
…from dependencies AsyncExitStack
|
📝 Docs preview for commit 9087a2a at: https://3154752a.fastapitiangolo.pages.dev Modified Pages |
|
📝 Docs preview for commit 343d3a2 at: https://01ef1bba.fastapitiangolo.pages.dev Modified Pages |
|
📝 Docs preview for commit 7acdb2c at: https://ac42d2b2.fastapitiangolo.pages.dev Modified Pages |
yield, close after the response is doneStreamingResponses with dependencies with yield or UploadFiles, close after the response is done
|
📝 Docs preview for commit e999745 at: https://b0ab811e.fastapitiangolo.pages.dev Modified Pages |
|
📝 Docs preview for commit b338294 at: https://07fe17cb.fastapitiangolo.pages.dev Modified Pages |
|
This PR also fixes #12508 |
🐛 Fix support for
StreamingResponses with dependencies withyieldorUploadFiles, close after the response is doneThere's (again) an
AsyncExitStackmiddleware, now used mainly to close objects after the response is done.There's also a new wrapper duplicating some logic in Starlette but creating an
AsyncExitStackfor the exit code in dependencies withyield, for regular responses and WebSockets as well.The exit code of dependencies with
yieldis now executed after the response is done.