Retry updater candidates after hash mismatch
This commit is contained in:
parent
ec45983810
commit
43950014b2
@ -941,7 +941,12 @@ export async function installLatestUpdate(
|
||||
if (updateAbortController.signal.aborted) {
|
||||
throw new Error("aborted:update_shutdown");
|
||||
}
|
||||
await downloadFromCandidates(candidates, targetPath, onProgress);
|
||||
let verified = false;
|
||||
let lastVerifyError: unknown = null;
|
||||
for (let index = 0; index < candidates.length; index += 1) {
|
||||
const candidate = candidates[index];
|
||||
try {
|
||||
await downloadWithRetries(candidate, targetPath, onProgress);
|
||||
if (updateAbortController.signal.aborted) {
|
||||
throw new Error("aborted:update_shutdown");
|
||||
}
|
||||
@ -950,9 +955,27 @@ export async function installLatestUpdate(
|
||||
percent: 100,
|
||||
downloadedBytes: 0,
|
||||
totalBytes: null,
|
||||
message: "Prüfe Installer-Integrität"
|
||||
message: `Prüfe Installer-Integrität (${index + 1}/${candidates.length})`
|
||||
});
|
||||
await verifyDownloadedInstaller(targetPath, String(effectiveCheck.setupAssetDigest || ""));
|
||||
verified = true;
|
||||
break;
|
||||
} catch (error) {
|
||||
lastVerifyError = error;
|
||||
try {
|
||||
await fs.promises.rm(targetPath, { force: true });
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
if (index >= candidates.length - 1) {
|
||||
throw error;
|
||||
}
|
||||
logger.warn(`Update-Kandidat ${index + 1}/${candidates.length} verworfen: ${compactErrorText(error)}`);
|
||||
}
|
||||
}
|
||||
if (!verified) {
|
||||
throw lastVerifyError || new Error("Update-Download fehlgeschlagen");
|
||||
}
|
||||
safeEmitProgress(onProgress, {
|
||||
stage: "launching",
|
||||
percent: 100,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user