From eefbbe4bbcf910035a1c67e1c7d91e49520182cd Mon Sep 17 00:00:00 2001 From: "eve-ci-cd[bot]" <169722304+eve-ci-cd[bot]@users.noreply.github.com> Date: Wed, 30 Sep 2026 12:35:24 +0000 Subject: [PATCH] fix: log total request duration instead of the microseconds component timedelta.microseconds is only the sub-second part (0-999999), so any request taking over one second was logged with a wrong, truncated time. Use total_seconds() and log it in seconds. --- bert_e/git_host/base.py | 4 ++-- bert_e/tests/test_bert_e.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bert_e/git_host/base.py b/bert_e/git_host/base.py index a38ab926..5b786e76 100644 --- a/bert_e/git_host/base.py +++ b/bert_e/git_host/base.py @@ -66,11 +66,11 @@ def request(self, method, url, **kwargs): for attempt in range(1, max_attempts + 1): try: response = super().request(method, url, **kwargs) - LOG.info("request: {method} {url} {status} {time}".format( + LOG.info("request: {method} {url} {status} {time:.3f}s".format( method=response.request.method, url=response.request.url, status=response.status_code, - time=response.elapsed.microseconds + time=response.elapsed.total_seconds() )) except Exception: LOG.error('{method} {url}'.format(method=method, url=url)) diff --git a/bert_e/tests/test_bert_e.py b/bert_e/tests/test_bert_e.py index 8b6126c5..972ea786 100644 --- a/bert_e/tests/test_bert_e.py +++ b/bert_e/tests/test_bert_e.py @@ -183,7 +183,7 @@ def fake_answer_internal(status_code, *args, **kwargs): response.status_code = 200 response.request.method = "GET" response.request.url = "http://localhost/" - response.elapsed.microseconds = 0 + response.elapsed.total_seconds.return_value = 0.0 return response