Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): replace Windows PowerShell port polling with netstat #18524

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

Showing 2 changed files with 134 additions and 0 deletions (loading 1).

x
0 of 2 viewed, 2 left
134 additions and 0 deletionsapps/server/src/preview/PortScanner.test.tsModified
View file
@@ -8,6 +8,7 @@
} from "@t3tools/contracts";
import * as HostProcess from "@t3tools/shared/HostProcess";
import * as Cause from "effect/Cause";
+import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
import * as Clock from "effect/Clock";
import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect";
@@ -789,3 +790,136 @@
}),
+​
+effectIt.effect(
+ "parses Windows netstat listeners, names them via tasklist with retry, and skips spawns when idle",
+ () => {
+ const spawnedArgs: Array<ReadonlyArray<string>> = [];
+ let tasklistCalls = 0;
+ const fetchFn = (() =>
+ Promise.resolve(
+ new Response("hello", { headers: { "content-type": "text/html" } }),
+ )) as typeof globalThis.fetch;
+ const layer = PortScanner.layer.pipe(
+ Layer.provide(
+ Layer.mergeAll(
+ layerNoProc,
+ Layer.succeed(ProcessRunner.ProcessRunner, {
+ run: (input) => {
+ spawnedArgs.push(input.args);