Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): editors appear once a slow discovery scan finishes #13917

Mergedbfowler(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/13917/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 4 changed files with 77 additions and 43 deletions (loading 2).

x
0 of 4 viewed, 4 left
21 additions and 20 deletionsapps/server/src/process/externalLauncher.test.tsModified
View file
@@ -6,6 +6,7 @@
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, it } from "@effect/vitest";
import * as ConfigProvider from "effect/ConfigProvider";
+import * as Deferred from "effect/Deferred";
import * as Effect from "effect/Effect";
import * as Fiber from "effect/Fiber";
import * as FileSystem from "effect/FileSystem";
@@ -1186,26 +1187,24 @@
-// A client that disconnects mid-scan interrupts the shared discovery effect on
-// the connection fiber. The cache must not retain that interrupt: doing so
-// replayed it to every later connect for the whole TTL, so `server.getConfig`
-// failed and no client could reconnect until the server restarted.
-it.effect("rescans after an interrupted discovery instead of caching the interrupt", () => {
+// Connects run discovery under a timeout and may disconnect mid-scan. Neither
+// may cancel the scan: on a busy host every connect would time out partway
+// through, cache nothing, and leave every client without editors.
+it.effect("keeps scanning after the caller is interrupted and shares that scan", () => {
const fileInfo = { type: "File" } as FileSystem.File.Info;
- let blockFirstScan = true;
- let scans = 0;
+ const release = Deferred.makeUnsafe<void>();
+ let parkedStats = 0;
const launcherLayer = ExternalLauncher.layer.pipe(
Layer.provide(
Layer.mergeAll(