Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(server): make the pull request lookup interval a background activity setting #12601

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

Showing 7 changed files with 119 additions and 10 deletions (loading 4).

x
0 of 7 viewed, 7 left
93 additions and 3 deletionsapps/server/src/git/GitManager.test.tsModified
View file
@@ -5,8 +5,11 @@
​
import * as NodeServices from "@effect/platform-node/NodeServices";
import { it } from "@effect/vitest";
+import * as Deferred from "effect/Deferred";
import * as Duration from "effect/Duration";
+import * as TestClock from "effect/testing/TestClock";
import * as Effect from "effect/Effect";
+import * as Fiber from "effect/Fiber";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
import * as Logger from "effect/Logger";
@@ -74,6 +77,8 @@
failWith?: GitHubCli.GitHubCliError;
/** Let this many gh calls succeed before failWith kicks in (default 0 = fail immediately). */
failAfterCalls?: number;
+ /** Runs before a `pr list` answers, so a test can hold one lookup open. */
+ beforePrList?: (headSelector: string) => Effect.Effect<void>;
​
function fakeGhOutput(stdout: string): VcsProcess.VcsProcessOutput {
@@ -396,7 +401,9 @@
? scenario.prListByHeadSelector?.[headSelector]
: undefined;
const stdout = (mappedQueue ?? mappedStdout ?? prListQueue.shift() ?? "[]") + "\n";
- return Effect.succeed(fakeGhOutput(stdout));
+ return (scenario.beforePrList?.(headSelector ?? "") ?? Effect.void).pipe(
+ Effect.as(fakeGhOutput(stdout)),