升级其它应用
This commit is contained in:
@@ -1567,6 +1567,14 @@ async fn run_updater(debug_mode: bool) -> bool {
|
|||||||
let ts = chrono::Local::now().format("%Y-%m-%d %H:%M:%S%.3f");
|
let ts = chrono::Local::now().format("%Y-%m-%d %H:%M:%S%.3f");
|
||||||
println!("{} [升级] 所有文件已是最新版本,等待下次检查...", ts);
|
println!("{} [升级] 所有文件已是最新版本,等待下次检查...", ts);
|
||||||
}
|
}
|
||||||
|
// 主动发送断连信号,让 run_updater 返回主循环
|
||||||
|
let ts = chrono::Local::now().format("%Y-%m-%d %H:%M:%S%.3f");
|
||||||
|
if debug_msg {
|
||||||
|
println!("{} [连接] 主动断开连接,返回主循环...", ts);
|
||||||
|
}
|
||||||
|
if let Some(tx) = shutdown_tx_arc_clone.lock().unwrap().take() {
|
||||||
|
let _ = tx.send(());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1810,6 +1818,20 @@ async fn main() {
|
|||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查其他应用的更新
|
||||||
|
if config.debug_mode {
|
||||||
|
println!("[应用] 开始检查其他应用程序更新...");
|
||||||
|
}
|
||||||
|
let dummy_shutdown_tx = std::sync::Arc::new(std::sync::Mutex::new(None::<tokio::sync::oneshot::Sender<()>>));
|
||||||
|
let other_updated = check_other_apps_updates(config.debug_mode, dummy_shutdown_tx).await;
|
||||||
|
if other_updated {
|
||||||
|
if config.debug_mode {
|
||||||
|
println!("[应用] 其他应用程序更新完成");
|
||||||
|
}
|
||||||
|
} else if config.debug_mode {
|
||||||
|
println!("[应用] 其他应用程序无需更新");
|
||||||
|
}
|
||||||
|
|
||||||
// 无更新 → 随机等待 5-10 分钟后再次检查
|
// 无更新 → 随机等待 5-10 分钟后再次检查
|
||||||
let wait_seconds = {
|
let wait_seconds = {
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
@@ -1851,20 +1873,5 @@ async fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 无 BootLoader/Updater 更新时,检查其他应用的更新
|
|
||||||
if config.debug_mode {
|
|
||||||
println!("[应用] 开始检查其他应用程序更新...");
|
|
||||||
}
|
|
||||||
let dummy_shutdown_tx = std::sync::Arc::new(std::sync::Mutex::new(None::<tokio::sync::oneshot::Sender<()>>));
|
|
||||||
let other_updated = check_other_apps_updates(config.debug_mode, dummy_shutdown_tx).await;
|
|
||||||
if other_updated {
|
|
||||||
if config.debug_mode {
|
|
||||||
println!("[应用] 其他应用程序更新完成");
|
|
||||||
}
|
|
||||||
// 可以选择在这里通知外部(如写日志文件)
|
|
||||||
} else if config.debug_mode {
|
|
||||||
println!("[应用] 其他应用程序无需更新");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user