diff --git a/admin/dashboard/blueprints/system.py b/admin/dashboard/blueprints/system.py index ab5ff76..1a6373c 100644 --- a/admin/dashboard/blueprints/system.py +++ b/admin/dashboard/blueprints/system.py @@ -41,7 +41,8 @@ def api_system_info(): "memory_usage": psutil.virtual_memory().percent, "disk_usage": psutil.disk_usage('/').percent, "uptime": time.time() - APP_START_TIME, # 使用应用启动时间计算运行时长 - "timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S") + "timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"), + "open_files": psutil.Process(os.getpid()).open_files() } return jsonify({"success": True, "data": system_info}) diff --git a/admin/dashboard/templates/index.html b/admin/dashboard/templates/index.html index bc8f5fa..33786b3 100644 --- a/admin/dashboard/templates/index.html +++ b/admin/dashboard/templates/index.html @@ -177,6 +177,7 @@ Python版本: {% raw %}{{ systemInfo.python_version }}{% endraw %} | 运行时间: {% raw %}{{ formattedUptime }}{% endraw %} | 最后更新: {% raw %}{{ systemInfo.timestamp }}{% endraw %} + 打开文件数: {% raw %}{{ systemInfo.open_files }}{% endraw %} diff --git a/main.py b/main.py index c9e580d..6165d33 100644 --- a/main.py +++ b/main.py @@ -137,5 +137,10 @@ def jobs(robot: Robot): logger.info("图片缓存更新完成") + @async_job.every_minutes(1) + async def check_open_files(): + os.open + + if __name__ == "__main__": main()