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
  • Loading branch information
bdraco authored Sep 18, 2024
1 parent eacf2e0 commit d3c3c6a
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 @@ -902,4 +902,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 d3c3c6a

Please sign in to comment.