mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-09-20 21:50:11 +08:00
fix(update-center): 修复更新中心点击更新后卡在"开始更新..."不动
- 根因:service.ts 用 webContents.send("queue-install") 向主下载队列发任务,
但 webContents.send 的目标对象是渲染进程,主进程 ipcMain 监听不到自己发出的消息,
导致任务从未进入 install-manager 的下载队列,UI 永远卡在 queued。
- 将 install-manager.ts 的 queue-install 处理逻辑抽为导出的 addInstallTask(payload, sender),
新增 QueueInstallPayload 类型,避免 any。
- 更新中心 service.ts 的 start() 改为直接 await addInstallTask(...),任务真正入队。
- 文档 docs/app-list-cache-analysis.md 新增第 9 节记录本修复。
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { BrowserWindow } from "electron";
|
||||
import {
|
||||
addInstallTask,
|
||||
type QueueInstallPayload,
|
||||
} from "../install-manager";
|
||||
import {
|
||||
IGNORE_CONFIG_PATH,
|
||||
applyIgnoredEntries,
|
||||
@@ -249,8 +253,9 @@ export const createUpdateCenterService = (
|
||||
? `${item.downloadUrl}.metalink`
|
||||
: undefined;
|
||||
|
||||
// 发送到主下载队列
|
||||
const installTaskData = {
|
||||
// 直接加入主下载队列(之前用 webContents.send("queue-install") 只会发给渲染端,
|
||||
// 主进程 ipcMain 监听不到自己发出的 send,导致任务实际未启动而卡死)。
|
||||
const installTaskData: QueueInstallPayload = {
|
||||
id: updateTaskId,
|
||||
pkgname: item.pkgname,
|
||||
metalinkUrl,
|
||||
@@ -260,8 +265,7 @@ export const createUpdateCenterService = (
|
||||
retry: false,
|
||||
};
|
||||
|
||||
// 通过 IPC 发送到主下载队列
|
||||
webContents.send("queue-install", JSON.stringify(installTaskData));
|
||||
await addInstallTask(installTaskData, webContents);
|
||||
|
||||
// 从更新中心的 items 中移除该应用(不再显示在更新列表中)
|
||||
currentItems = currentItems.filter(
|
||||
|
||||
Reference in New Issue
Block a user