Skip to content

Commit

Permalink
[PR #9173/d3c3c6a7 backport][3.11] Avoid calling response prepare hoo…
Browse files Browse the repository at this point in the history
…k if its empty (#9189)

Co-authored-by: J. Nick Koston <[email protected]>
  • Loading branch information
patchback[bot] and bdraco authored Sep 18, 2024
1 parent 71c47e4 commit 45dd34c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/9173.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved performance of starting web requests when there is no response prepare hook -- by :user:`bdraco`.
3 changes: 2 additions & 1 deletion aiohttp/web_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,4 +915,5 @@ async def _prepare_hook(self, response: StreamResponse) -> None:
if match_info is None:
return
for app in match_info._apps:
await app.on_response_prepare.send(self, response)
if on_response_prepare := app.on_response_prepare:
await on_response_prepare.send(self, response)

0 comments on commit 45dd34c

Please sign in to comment.