Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): isolate Linux process launches from the RPC event loop #30209

Mergedvoltcrash(GitHub profile, opens in a new tab)merged 7 commits intomain fromrefs/pull/30209/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 23 additions and 9 deletions.

x
0 of 2 viewed, 2 left
13 additions and 4 deletionsapps/server/src/process/SpawnWorker.test.tsModified
View file
@@ -3,6 +3,7 @@
import * as NodePath from "node:path";
import * as NodeServices from "@effect/platform-node/NodeServices";
import { describe, expect, it } from "@effect/vitest";
+import { vi } from "vite-plus/test";
import * as Deferred from "effect/Deferred";
import * as Effect from "effect/Effect";
import * as Fiber from "effect/Fiber";
@@ -15,6 +16,12 @@
​
import * as SpawnWorker from "./SpawnWorker.ts";
​
+const envChdir = vi.hoisted(() => ({ supported: true }));
+vi.mock("@t3tools/shared/envTrampoline", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("@t3tools/shared/envTrampoline")>()),
+ supportsEnvChdir: () => Promise.resolve(envChdir.supported),
+}));
+​
const layer = SpawnWorker.layer.pipe(Layer.provide(NodeServices.layer));
const text = <E>(stream: Stream.Stream<Uint8Array, E>) =>
stream.pipe(Stream.decodeText(), Stream.mkString);
@@ -22,12 +29,14 @@
ChildProcess.make(process.execPath, ["-e", script, ...args], options);
​
describe("SpawnWorker", () => {
- it.live("runs the server's Windows children on a launcher thread, not the server thread", () =>
+ it.live("runs children on a launcher thread where the server thread would wait on them", () =>
Effect.gen(function* () {