Skip to content

Commit a1ff3d1

Browse files
bdracoDreamsorcerer
authored andcommitted
Re-backport: Avoid fetching loop time on each request unless logging is enabled (#10713)
Co-authored-by: Sam Bull <git@sambull.org>
1 parent a76721a commit a1ff3d1

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGES/10713.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Optimized web server performance when access logging is disabled by reducing time syscalls -- by :user:`bdraco`.

aiohttp/web_protocol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def force_close(self) -> None:
457457
def log_access(
458458
self, request: BaseRequest, response: StreamResponse, time: float | None
459459
) -> None:
460-
if self.access_logger is not None and self.access_logger.enabled:
460+
if self._logging_enabled and self.access_logger is not None:
461461
if TYPE_CHECKING:
462462
assert time is not None
463463
self.access_logger.log(request, response, self._loop.time() - time)

0 commit comments

Comments
 (0)