From 5558dd181b952ebebe74ee74d78eddc6b4be1abd Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Mon, 28 Jul 2025 15:07:31 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=80=97=E6=97=B6=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module_admin/annotation/log_annotation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-fastapi-backend/module_admin/annotation/log_annotation.py b/ruoyi-fastapi-backend/module_admin/annotation/log_annotation.py index 1d01c1c..4485247 100644 --- a/ruoyi-fastapi-backend/module_admin/annotation/log_annotation.py +++ b/ruoyi-fastapi-backend/module_admin/annotation/log_annotation.py @@ -46,7 +46,7 @@ class Log: def __call__(self, func): @wraps(func) async def wrapper(*args, **kwargs): - start_time = time.time() + start_time = time.perf_counter() # 获取被装饰函数的文件路径 file_path = inspect.getfile(func) # 获取项目根路径 @@ -129,7 +129,7 @@ class Log: logger.exception(e) result = ResponseUtil.error(msg=str(e)) # 获取请求耗时 - cost_time = float(time.time() - start_time) * 100 + cost_time = float(time.perf_counter() - start_time) * 1000 # 判断请求是否来自api文档 request_from_swagger = ( request.headers.get('referer').endswith('docs') if request.headers.get('referer') else False