@devries-cameron20 / t3code-1 / commits / 9304d843e5
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

perf(server): stop tracing routine port polling helpers (#30678)

Elliot Drel committed Nov 5, 2026 at 23:35 UTC 9304d843e59b6f42ce36c14461e2467ceb0fc7f4
1 file changed +8 -9
apps/server/src/preview/PortScanner.ts
+8 -9
@@ -684,7 +684,8 @@ export const make = Effect.gen(function* PortDiscoveryMake() {
684 // Only configured URLs are requested. Owned listeners are listed as plain HTTP without a
685 // request: owning a process says nothing about its protocol, and HTTP or TLS bytes break
686 // binary ones such as Unity's test runner or Steam's IPC.
687 - const probeWebServers = Effect.fn("PortDiscovery.probeWebServers")(function* (
687 + // Idle polls omit this span; requested scans and uncached probes retain their own spans.
688 + const probeWebServers = Effect.fnUntraced(function* (
689 servers: ReadonlyArray<DiscoveredLocalServer>,
690 configuredUrls: ReadonlyArray<string>,
691 ) {
@@ -781,9 +782,8 @@ export const make = Effect.gen(function* PortDiscoveryMake() {
782 platform: hostPlatform,
783 }).pipe(Effect.as(null));
784
784 - const scanUnlocked = Effect.fn("PortDiscovery.scanUnlocked")(function* (
785 - configuredUrls: ReadonlyArray<string>,
786 - ) {
785 + // Routine polling helpers share operation/probe spans instead of tracing every tick.
786 + const scanUnlocked = Effect.fnUntraced(function* (configuredUrls: ReadonlyArray<string>) {
787 if (!listenerDiscovery) return yield* probeWebServers([], configuredUrls);
788 const state = yield* Ref.get(stateRef);
789 const terminalOwners = new Map<number, ServerOwner>();
@@ -860,19 +860,18 @@ export const make = Effect.gen(function* PortDiscoveryMake() {
860 return yield* probeWebServers(fromProc ?? [], configuredUrls);
861 });
862
863 - const scanSnapshot = Effect.fn("PortDiscovery.scanSnapshot")(
864 - (configuredUrls: ReadonlyArray<string>) =>
865 - scanSemaphore.withPermits(1)(scanUnlocked(configuredUrls)),
866 - );
863 + const scanSnapshot = (configuredUrls: ReadonlyArray<string>) =>
864 + scanSemaphore.withPermits(1)(scanUnlocked(configuredUrls));
865
866 const scanOnce: PortDiscovery["Service"]["scan"] = (configuredUrls = []) => {
867 const normalized = normalizeConfiguredUrls(configuredUrls);
868 return scanSnapshot(normalized).pipe(
869 Effect.map((snapshot) => projectWebProbeSnapshot(snapshot, normalized)),
870 + Effect.withSpan("PortDiscovery.scan"),
871 );
872 };
873
875 - const pollTick = Effect.fn("PortDiscovery.pollTick")(
874 + const pollTick = Effect.fnUntraced(
875 function* () {
876 const configuredUrls = [
877 ...new Set(