From 4ad1c054443b7c69123a22f0ab156492d420dbca Mon Sep 17 00:00:00 2001 From: Sucukdeluxe Date: Thu, 5 Mar 2026 05:08:09 +0100 Subject: [PATCH] Fix extraction UI labels and speed for final extraction pass MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Force immediate emitState when first resolving archive items so UI transitions from 'Ausstehend' to 'Entpacken X%' instantly - Use BELOW_NORMAL priority (instead of IDLE) for final extraction when all downloads are complete — matches manual extraction speed - Add diagnostic logging for resolveArchiveItems matching Co-Authored-By: Claude Opus 4.6 --- src/main/download-manager.ts | 42 +++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/src/main/download-manager.ts b/src/main/download-manager.ts index 7e04171..5ec2be9 100644 --- a/src/main/download-manager.ts +++ b/src/main/download-manager.ts @@ -6419,8 +6419,26 @@ export class DownloadManager extends EventEmitter { if (progress.archiveName) { // Resolve items for this archive if not yet tracked if (!activeHybridArchiveMap.has(progress.archiveName)) { - activeHybridArchiveMap.set(progress.archiveName, resolveArchiveItems(progress.archiveName)); + const resolved = resolveArchiveItems(progress.archiveName); + activeHybridArchiveMap.set(progress.archiveName, resolved); hybridArchiveStartTimes.set(progress.archiveName, nowMs()); + if (resolved.length === 0) { + logger.warn(`resolveArchiveItems (hybrid): KEINE Items gefunden für archiveName="${progress.archiveName}", items.length=${items.length}, itemNames=[${items.slice(0, 5).map((i) => path.basename(i.targetPath || i.fileName || "?")).join(", ")}]`); + } else { + logger.info(`resolveArchiveItems (hybrid): ${resolved.length} Items für archiveName="${progress.archiveName}"`); + // Immediately label the matched items and force emit so the UI + // transitions from "Ausstehend" to the extraction label right away. + const initLabel = `Entpacken 0% · ${progress.archiveName}`; + const initAt = nowMs(); + for (const entry of resolved) { + if (!isExtractedLabel(entry.fullStatus)) { + entry.fullStatus = initLabel; + entry.updatedAt = initAt; + } + } + hybridLastEmitAt = initAt; + this.emitState(true); + } } const archItems = activeHybridArchiveMap.get(progress.archiveName)!; @@ -6744,7 +6762,9 @@ export class DownloadManager extends EventEmitter { packageId, skipPostCleanup: true, maxParallel: this.settings.maxParallelExtract || 2, - extractCpuPriority: this.settings.extractCpuPriority, + // All downloads finished — use highest configured priority so extraction + // isn't starved. "high" maps to BELOW_NORMAL instead of the default IDLE. + extractCpuPriority: "high", onProgress: (progress) => { if (progress.phase === "preparing") { pkg.postProcessLabel = progress.archiveName || "Vorbereiten..."; @@ -6764,8 +6784,24 @@ export class DownloadManager extends EventEmitter { if (progress.archiveName) { // Resolve items for this archive if not yet tracked if (!activeArchiveItemsMap.has(progress.archiveName)) { - activeArchiveItemsMap.set(progress.archiveName, resolveArchiveItems(progress.archiveName)); + const resolved = resolveArchiveItems(progress.archiveName); + activeArchiveItemsMap.set(progress.archiveName, resolved); archiveStartTimes.set(progress.archiveName, nowMs()); + if (resolved.length === 0) { + logger.warn(`resolveArchiveItems (full): KEINE Items für archiveName="${progress.archiveName}", completedItems=${completedItems.length}, names=[${completedItems.slice(0, 5).map((i) => path.basename(i.targetPath || i.fileName || "?")).join(", ")}]`); + } else { + logger.info(`resolveArchiveItems (full): ${resolved.length} Items für archiveName="${progress.archiveName}"`); + // Immediately label items and force emit for instant UI feedback + const initLabel = `Entpacken 0% · ${progress.archiveName}`; + const initAt = nowMs(); + for (const entry of resolved) { + if (!isExtractedLabel(entry.fullStatus)) { + entry.fullStatus = initLabel; + entry.updatedAt = initAt; + } + } + emitExtractStatus(`Entpacken ${progress.percent}% · ${progress.archiveName}`, true); + } } const archiveItems = activeArchiveItemsMap.get(progress.archiveName)!;