Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions apps/web/src/connection/desktopLocalDiscovery.expbkt3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* T3-CUSTOM(expbkt3): how long a desktop-local backend may take to describe itself.
*
* The platform source builds every registration before it hands any of them
* to the registry, so the primary environment is not connected until each
* desktop-local backend has answered. A managed build starts its bundled
* backend after the window opens, and a backend still starting holds every
* request until startup finishes. With the default 10 s request timeout, a
* window opened during that start waited 10 s before it even asked the
* remote primary for a WebSocket ticket.
*
* A ready loopback backend answers in milliseconds. One that misses this
* deadline is skipped for this poll and retried on the next one, 3 s later.
*/
export const DESKTOP_LOCAL_DESCRIPTOR_TIMEOUT_MS = 1_500;
10 changes: 7 additions & 3 deletions apps/web/src/connection/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ import { connectionStorageLayer } from "./storage";
import { clientPresentationMetadata } from "./clientMetadata";
// T3-CUSTOM(expbkt3): focus wakeups probe unless the window was away >= 60 s.
import { type FocusWakeup, makeFocusWakeupTracker } from "./focusWakeup.expbkt3";
// T3-CUSTOM(expbkt3): desktop-local discovery must not delay the primary.
import { DESKTOP_LOCAL_DESCRIPTOR_TIMEOUT_MS } from "./desktopLocalDiscovery.expbkt3";

let nextObservedRpcRequestId = 0;

Expand Down Expand Up @@ -411,9 +413,11 @@ const loadSecondaryConnectionRegistration = Effect.fn(
}
const httpBaseUrl = entry.httpBaseUrl;
const wsBaseUrl = entry.wsBaseUrl;
const descriptor = yield* fetchRemoteEnvironmentDescriptor({ httpBaseUrl }).pipe(
Effect.mapError(mapRemoteEnvironmentError),
);
const descriptor = yield* fetchRemoteEnvironmentDescriptor({
httpBaseUrl,
// T3-CUSTOM(expbkt3): a starting local backend must not hold up the primary.
timeoutMs: DESKTOP_LOCAL_DESCRIPTOR_TIMEOUT_MS,
}).pipe(Effect.mapError(mapRemoteEnvironmentError));
const issuedAtEpochMs = yield* Clock.currentTimeMillis;
const access = yield* bootstrapRemoteBearerSession({
httpBaseUrl,
Expand Down
Loading