From 39c8cfed2d0fce9ccd397a7a12195ef1ac14b0a3 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 1 Jun 2026 23:26:27 +0800 Subject: [PATCH] Reduce noisy debug logs - hotreload: only log signal file when mtime actually changes - auth_api: only log timecost for requests taking > 1 second --- ahserver/auth_api.py | 3 ++- ahserver/hotreload.py | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ahserver/auth_api.py b/ahserver/auth_api.py index 8a042e8..29bcf8d 100644 --- a/ahserver/auth_api.py +++ b/ahserver/auth_api.py @@ -174,7 +174,8 @@ class AuthAPI: try: ret = await handler(request) t3 = time.time() - debug(f'timecost=client({ip}) {user} access {path} cost {t3-t1}, ({t2-t1})') + if t3 - t1 > 1.0: + debug(f'timecost=client({ip}) {user} access {path} cost {t3-t1:.3f}, ({t2-t1:.3f})') return ret except Exception as e: t3 = time.time() diff --git a/ahserver/hotreload.py b/ahserver/hotreload.py index b57236d..8b04edf 100644 --- a/ahserver/hotreload.py +++ b/ahserver/hotreload.py @@ -110,10 +110,9 @@ class HotReloader: """Check if cache invalidation signal file was updated.""" try: mtime = os.path.getmtime(SIGNAL_FILE) - debug(f'[hot_reload] signal file mtime: {mtime}, last: {self._last_signal_mtime}') if mtime > self._last_signal_mtime: self._last_signal_mtime = mtime - debug('[hot_reload] signal file changed, triggering reload') + debug(f'[hot_reload] signal file changed, mtime: {mtime}') return True except OSError: pass