Skip to content

Commit

Permalink
Avoid calling response prepare hook if its empty (#9173)
Browse files Browse the repository at this point in the history
(cherry picked from commit d3c3c6a)
  • Loading branch information
bdraco authored and patchback[bot] committed Sep 18, 2024
1 parent b15c895 commit c1fde78
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 c1fde78

Please sign in to comment.