From 167ef235e6e75ae674843a6805c16f61f63ea150 Mon Sep 17 00:00:00 2001 From: qing <1776177662@qq.com> Date: Mon, 27 Jul 2026 14:47:12 +0800 Subject: [PATCH] fixbug 100% cpu --- dnfs/log_client.py | 2 +- smtp/log_client.py | 2 +- static/log_client.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dnfs/log_client.py b/dnfs/log_client.py index 043d379..f3188b6 100644 --- a/dnfs/log_client.py +++ b/dnfs/log_client.py @@ -106,7 +106,7 @@ class LogClient: while not self._stop.is_set(): timeout = self._flush_interval - (time.monotonic() - last_flush) - chk_timeout = max(0.0, min(timeout, 0.5)) + chk_timeout = max(0.1, min(timeout, 0.5)) try: item = self._queue.get(timeout=chk_timeout) batch.append(item) diff --git a/smtp/log_client.py b/smtp/log_client.py index 47c1ed7..e2358a5 100644 --- a/smtp/log_client.py +++ b/smtp/log_client.py @@ -114,7 +114,7 @@ class LogClient: while not self._stop.is_set(): timeout = self._flush_interval - (time.monotonic() - last_flush) # 限制最长阻塞时间,以便及时响应 flush() 信号 - chk_timeout = max(0.0, min(timeout, 0.5)) + chk_timeout = max(0.1, min(timeout, 0.5)) try: item = self._queue.get(timeout=chk_timeout) batch.append(item) diff --git a/static/log_client.py b/static/log_client.py index 422097d..f70e750 100644 --- a/static/log_client.py +++ b/static/log_client.py @@ -109,7 +109,7 @@ class LogClient: while not self._stop.is_set(): timeout = self._flush_interval - (time.monotonic() - last_flush) - chk_timeout = max(0.0, min(timeout, 0.5)) + chk_timeout = max(0.1, min(timeout, 0.5)) try: item = self._queue.get(timeout=chk_timeout) batch.append(item)