fix(desktop): retain cold-start budget after runtime installation
This commit is contained in:
@@ -39,6 +39,7 @@ export async function withBootstrapAwareTimeout<T>(
|
||||
cancelled: () => boolean = () => false
|
||||
): Promise<T> {
|
||||
let settled = false
|
||||
let setupObserved = false
|
||||
const request = promise.then(
|
||||
value => {
|
||||
settled = true
|
||||
@@ -58,9 +59,17 @@ export async function withBootstrapAwareTimeout<T>(
|
||||
throw error
|
||||
}
|
||||
const state = await withTimeout(bootstrapState(), Math.min(ms, 5_000), message)
|
||||
if (!state?.active && !state?.setupChoice) {
|
||||
throw error
|
||||
if (state?.active || state?.setupChoice) {
|
||||
setupObserved = true
|
||||
continue
|
||||
}
|
||||
// Setup may have finished just before this probe. The new backend must
|
||||
// still receive one complete cold-start budget after the installer.
|
||||
if (setupObserved) {
|
||||
setupObserved = false
|
||||
continue
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user