mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-06-02 22:30:36 +08:00
fix(lifecycle): 卸载/升级 OpenClaw 后同步刷新 Rust 缓存与前端缓存
这是 #Compat-4(安装不识别修复)的收尾补丁。除了 setup 安装场景, OpenClaw 的卸载和升级场景也存在类似的缓存失效问题。 ## Rust 端:uninstall_openclaw_inner 卸载后刷缓存 卸载完成时只 emit 了 "upgrade-progress 100",但没有刷 enhanced_path 和 CLI 检测缓存。后果: - `is_cli_installed`(60s TTL)在卸载后 60 秒内仍返回 true,UI 显示 「CLI 已安装」 - 服务状态页 gateway 被误判为还在运行 在 emit 进度 100 之后立刻调用: - `super::refresh_enhanced_path()` - `crate::commands::service::invalidate_cli_detection_cache()` ## 前端:upgrade/uninstall/installGateway/uninstallGateway 清前端缓存 `upgrade_openclaw` / `uninstall_openclaw` / `install_gateway` / `uninstall_gateway` 这四个 API 会改变 CLI 状态或 Gateway 状态,但 原先直接 invoke,没有清前端的 cachedInvoke 缓存。Rust 端自己刷了 缓存没用,前端仍吃旧的 `check_installation` / `get_services_status` / `get_version_info` 缓存(60s / 10s / 30s TTL)。 统一在调用前 invalidate 相关缓存: - upgrade/uninstall OpenClaw → 清 check_installation / check_node / check_git / get_services_status / get_status_summary / get_version_info - install/uninstall Gateway → 清 get_services_status / get_status_summary ## 验证 - `cargo check` 通过 - `npm run build` 通过
This commit is contained in:
@@ -4191,6 +4191,10 @@ async fn uninstall_openclaw_inner(
|
||||
}
|
||||
|
||||
let _ = app.emit("upgrade-progress", 100);
|
||||
// #Compat-4: 卸载后刷缓存,否则 is_cli_installed(60s TTL)/ enhanced_path
|
||||
// 仍是旧快照,UI 会在 60 秒内继续显示「CLI 已安装」或 Gateway 还在运行。
|
||||
super::refresh_enhanced_path();
|
||||
crate::commands::service::invalidate_cli_detection_cache();
|
||||
let msg = if clean_config {
|
||||
"✅ OpenClaw 已完全卸载(包括配置文件)"
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user