fix(web): keep auto-retrying when the WSL bootstrap hasn't appeared yet
The auto-retry loop short-circuited the moment readBootstraps() returned no secondary entries. That looked right in isolation: "nothing pending, stop polling." But the desktop pool only publishes a backend's bootstrap once the backend's first start cycle has produced a config (see desktop.ipc.window.getLocalEnvironmentBootstraps's `Option.isNone(config) continue`), so a WSL backend mid-cold-boot is indistinguishable from "no WSL configured" from the renderer's side. The short-circuit fired before the WSL bootstrap got published, the loop stopped, and the env never registered. Drop the hasPendingSecondary gate. We still cap at the full backoff schedule (8 attempts, ~225s) and reconcileOnce is a no-op when every secondary is already registered, so the cost of running the budget out is a handful of cheap IPC calls. The payoff is that a WSL cold boot taking longer than the initial reconcile (which is the common case, not the exception) now actually gets caught.
This commit is contained in:
1 parent
ad7e3d7790
commit
0dbdd9f47f
1 file changed
+7
-10
@@ -252,19 +252,16 @@ async function reconcileOnce(): Promise<void> {
|
||||
);
|
||||
}
|
||||
|
||||
function hasPendingSecondary(): boolean {
|
||||
const bootstraps = readBootstraps();
|
||||
for (const bootstrap of bootstraps) {
|
||||
if (bootstrap.id === PRIMARY_LOCAL_ENVIRONMENT_ID) continue;
|
||||
if (!findRecordByInstanceId(bootstrap.id)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function scheduleAutoRetry(): void {
|
||||
if (autoRetryHandle !== null) return;
|
||||
if (autoRetryAttempt >= AUTO_RETRY_DELAYS_MS.length) return;
|
||||
if (!hasPendingSecondary()) return;
|
||||
// Note: we deliberately don't short-circuit when the current bootstraps
|
||||
// list lacks any secondary entry. The desktop pool only publishes a
|
||||
// backend's bootstrap once its first start cycle has produced a config
|
||||
// (see desktop.ipc.window.getLocalEnvironmentBootstraps), so an in-flight
|
||||
// WSL cold boot looks identical to "no WSL configured" from this side.
|
||||
// We have to keep polling until either a secondary actually shows up or
|
||||
// the budget runs out.
|
||||
const delay = AUTO_RETRY_DELAYS_MS[autoRetryAttempt];
|
||||
autoRetryAttempt += 1;
|
||||
autoRetryHandle = setTimeout(() => {
|
||||
|
||||
Reference in new issue
Block a user