From 68237d990548461d08854c2b4098d791cd930aa4 Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 28 Dec 2025 06:23:20 -0800 Subject: [PATCH] =?UTF-8?q?chore(mobile-app):=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E7=BB=B4=E6=8A=A4=E7=8A=B6=E6=80=81=E8=BD=AE=E8=AF=A2=E9=97=B4?= =?UTF-8?q?=E9=9A=94=E4=B8=BA30-60=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 减少服务器压力: - 将轮询间隔从 3-6 秒调整为 30-60 秒 - 10,000 用户时每秒约 222 次请求(之前约 2,222 次) - 用户最多 60 秒内发现维护状态变化 - 启动时和从后台恢复时仍立即检查 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../features/home/presentation/pages/home_shell_page.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/mobile-app/lib/features/home/presentation/pages/home_shell_page.dart b/frontend/mobile-app/lib/features/home/presentation/pages/home_shell_page.dart index b16e4172..56e9fc32 100644 --- a/frontend/mobile-app/lib/features/home/presentation/pages/home_shell_page.dart +++ b/frontend/mobile-app/lib/features/home/presentation/pages/home_shell_page.dart @@ -81,7 +81,7 @@ class _HomeShellPageState extends ConsumerState } } - /// 启动维护状态定时检查(随机 3-6 秒检查一次) + /// 启动维护状态定时检查(随机 30-60 秒检查一次) void _startMaintenanceCheck() { _scheduleNextMaintenanceCheck(); } @@ -89,8 +89,8 @@ class _HomeShellPageState extends ConsumerState /// 安排下一次维护检查 void _scheduleNextMaintenanceCheck() { _maintenanceCheckTimer?.cancel(); - // 随机 3-6 秒 - final randomSeconds = 3 + Random().nextInt(4); // 3 + 0~3 = 3~6 + // 随机 30-60 秒,平衡及时性和服务器压力 + final randomSeconds = 30 + Random().nextInt(31); // 30 + 0~30 = 30~60 _maintenanceCheckTimer = Timer(Duration(seconds: randomSeconds), () async { await _checkMaintenanceStatus(); // 检查完成后安排下一次检查