Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(pull-requests): PR detail reads no longer drain the GitHub quota #13841

ClosedStiensWout(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/13841/headopened View on GitHub

Showing 4 changed files with 70 additions and 8 deletions (loading 2).

x
0 of 4 viewed, 4 left
53 additions and 4 deletionsapps/server/src/pullRequest/PullRequestService.test.tsModified
View file
@@ -229,7 +229,7 @@
yield* service.detail(ref);
assert.strictEqual((yield* service.preview(ref)).title, "Change request 1");
assert.strictEqual(previewReads, 0);
- yield* TestClock.adjust("16 seconds");
+ yield* TestClock.adjust("61 seconds");
const preview = yield* service.preview(ref);
assert.strictEqual(preview.title, "Updated title");
assert.strictEqual(preview.state, "closed");
@@ -237,6 +237,55 @@
}),
​
+it.effect("shares detail and activity for a minute, and for ten once merged", () =>
+ Effect.gen(function* () {
+ const reads: Array<string> = [];
+ const service = yield* makeService({
+ projects: [project({ id: "p1", title: "web", workspaceRoot: "/w", repository: "acme/web" })],
+ providers: [
+ fakeProvider("github", {
+ getChangeRequest: ({ number }) =>
+ Effect.sync(() => {
+ reads.push(`detail #${number}`);
+ return {
+ ...hostedChangeRequest("Description"),
+ number,
+ state: number === 1 ? ("open" as const) : ("merged" as const),
+ };
+ }),