Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf: stop tracing every command-path probe and bound git spawns #4778

Closedarubi9(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/4778/headopened View on GitHub

Showing 4 changed files with 95 additions and 0 deletions (loading 1).

x
0 of 4 viewed, 4 left
44 additions and 0 deletionsapps/server/src/vcs/VcsProcess.test.tsModified
View file
@@ -1,5 +1,6 @@
import * as NodeServices from "@effect/platform-node/NodeServices";
import { describe, expect, it } from "@effect/vitest";
+import * as Deferred from "effect/Deferred";
import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect";
import * as Fiber from "effect/Fiber";
@@ -45,6 +46,49 @@
);
​
describe("VcsProcess.run", () => {
+ it.effect("bounds how many processes it spawns at once", () =>
+ Effect.gen(function* () {
+ const release = yield* Deferred.make<void>();
+ let inFlight = 0;
+ let peakInFlight = 0;
+​
+ const service = yield* VcsProcess.make.pipe(
+ Effect.provideService(
+ ProcessRunner.ProcessRunner,
+ ProcessRunner.ProcessRunner.of({
+ run: () =>
+ Effect.gen(function* () {
+ inFlight += 1;
+ peakInFlight = Math.max(peakInFlight, inFlight);
+ yield* Deferred.await(release);
+ inFlight -= 1;
+ return {
+ code: 0,
+ stdout: "",