Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): background branch lookups share one GitHub query per sweep #16760

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/16760/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 69 additions and 15 deletions.

x
0 of 2 viewed, 2 left
53 additions and 12 deletionsapps/server/src/sourceControl/GitHubCli.test.tsModified
View file
@@ -251,7 +251,7 @@
describe("GitHubCli.listPullRequestsByHead", () => {
const remotes = remotesOutput(["origin", "git@github.com:acme/web.git"]);
​
- it.effect("reads heads on one repository in one GraphQL document", () => {
+ it.effect("reads a background sweep's staggered heads in one GraphQL document", () => {
const documents: Array<GitHubApi.GitHubGraphQlInput> = [];
const { layer } = harness({
remotes,
@@ -267,20 +267,23 @@
});
return Effect.gen(function* () {
const gh = yield* GitHubCli.GitHubCli;
- const lookups = yield* Effect.all(
- ["feature/a", "feature/b"].map((headSelector) =>
- gh.listPullRequestsByHead({
+ const lookup = (headSelector: string) =>
+ gh
+ .listPullRequestsByHead({
cwd: "/repo",
headSelector,
state: "all",
limit: 100,
rateLimitHost: "github.com",
- }),
- ),
- { concurrency: "unbounded" },
- ).pipe(Effect.forkChild);
- yield* TestClock.adjust("50 millis");