Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): PR reads no longer join canceled cache lookups #14654

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

Showing 3 changed files with 83 additions and 0 deletions.

x
0 of 3 viewed, 3 left
57 additions and 0 deletionsapps/server/src/pullRequest/PullRequestService.test.tsModified
View file
@@ -263,6 +263,63 @@
}),
​
+it.effect("starts a fresh detail lookup while an interrupted read is cleaning up", () =>
+ Effect.gen(function* () {
+ const detailStarted = yield* Deferred.make<void>();
+ const cleanupStarted = yield* Deferred.make<void>();
+ const releaseCleanup = yield* Deferred.make<void>();
+ let calls = 0;
+ const service = yield* makeService({
+ projects: [project({ id: "p1", title: "web", workspaceRoot: "/w", repository: "acme/web" })],
+ providers: [
+ fakeProvider("github", {
+ getChangeRequest: () => {
+ const call = ++calls;
+ return Effect.gen(function* () {
+ if (call === 1) {
+ yield* Deferred.succeed(detailStarted, undefined);
+ return yield* Effect.never;
+ }
+ return hostedChangeRequest("fresh detail");
+ }).pipe(
+ Effect.ensuring(
+ call === 1
+ ? Deferred.succeed(cleanupStarted, undefined).pipe(
+ Effect.andThen(Deferred.await(releaseCleanup)),
+ )
+ : Effect.void,
+ ),