Skip to content

Commit 09083c3

Browse files
committed
fix(vcs): do not surface a stale refresh failure
Join the in-flight fiber via Exit so a pre-invalidation failure cannot return before the follow-up rerun is joined.
1 parent 5344bb3 commit 09083c3

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎apps/server/src/vcs/VcsStatusBroadcaster.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,11 +495,17 @@ export const make = Effect.gen(function* () {
495495
}),
496496
);
497497
});
498-
const result = yield* Fiber.join(inFlight.fiber);
498+
const exit = yield* Fiber.await(inFlight.fiber);
499499
const latestGeneration = yield* invalidateGenerationOf(cwd);
500-
if (inFlight.startedGeneration >= latestGeneration) {
501-
return result;
500+
// A stale run's failure must not surface: settleRefreshFiber may already
501+
// have started the post-invalidation rerun this waiter should join.
502+
if (inFlight.startedGeneration < latestGeneration) {
503+
continue;
502504
}
505+
if (Exit.isFailure(exit)) {
506+
return yield* Effect.failCause(exit.cause);
507+
}
508+
return exit.value;
503509
}
504510
});
505511

0 commit comments

Comments
 (0)