Skip to content

Commit d943404

Browse files
committed
Changed moment of starting debug timing handlers
1 parent 420ef62 commit d943404

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

adafruit_httpserver/server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,12 @@ def poll(self) -> str:
443443

444444
conn = None
445445
try:
446+
if self.debug:
447+
_debug_start_time = monotonic()
448+
446449
conn, client_address = self._sock.accept()
447450
conn.settimeout(self._timeout)
448451

449-
_debug_start_time = monotonic()
450-
451452
# Receive the whole request
452453
if (request := self._receive_request(conn, client_address)) is None:
453454
conn.close()
@@ -468,9 +469,8 @@ def poll(self) -> str:
468469
# Send the response
469470
response._send() # pylint: disable=protected-access
470471

471-
_debug_end_time = monotonic()
472-
473472
if self.debug:
473+
_debug_end_time = monotonic()
474474
_debug_response_sent(response, _debug_end_time - _debug_start_time)
475475

476476
return REQUEST_HANDLED_RESPONSE_SENT

0 commit comments

Comments
 (0)