Close startup and recovery transaction gaps
This commit is contained in:
+18
-11
@@ -41,6 +41,19 @@ function createStartupRecoveryCoordinator({ load, reload, reveal, showFailure, c
|
||||
return terminalFailure;
|
||||
}
|
||||
|
||||
async function recoverRenderer(phase, details) {
|
||||
if (terminalFailure) return terminalFailure;
|
||||
if (crashReloads >= 1) {
|
||||
return endWithFailure({ phase, attempt: crashReloads + 1, details });
|
||||
}
|
||||
crashReloads++;
|
||||
try {
|
||||
await reload();
|
||||
} catch (error) {
|
||||
return endWithFailure({ phase: 'renderer-reload', attempt: crashReloads, details, error });
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
loadInitial(...args) {
|
||||
if (terminalFailure) return terminalFailure;
|
||||
@@ -59,17 +72,11 @@ function createStartupRecoveryCoordinator({ load, reload, reveal, showFailure, c
|
||||
}
|
||||
return initialLoad;
|
||||
},
|
||||
async rendererCrashed(details) {
|
||||
if (terminalFailure) return terminalFailure;
|
||||
if (crashReloads >= 1) {
|
||||
return endWithFailure({ phase: 'renderer-crash', attempt: crashReloads + 1, details });
|
||||
}
|
||||
crashReloads++;
|
||||
try {
|
||||
await reload();
|
||||
} catch (error) {
|
||||
return endWithFailure({ phase: 'renderer-reload', attempt: crashReloads, details, error });
|
||||
}
|
||||
rendererCrashed(details) {
|
||||
return recoverRenderer('renderer-crash', details);
|
||||
},
|
||||
rendererInitializationFailed(details) {
|
||||
return recoverRenderer('renderer-initialization', details);
|
||||
},
|
||||
rendererReady() {
|
||||
if (terminalFailure) return false;
|
||||
|
||||
Reference in New Issue
Block a user