fix(vcs): share in-flight status refreshes per repository #7185
Closedmaslinedwin(GitHub profile, opens in a new tab)wants to merge 3 commits into
main fromrefs/pull/7185/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/server/src/vcs/VcsStatusBroadcaster.ts line 510Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -381,0 +393,21 @@393+ return Effect.succeed([existing, inFlight] as const);394+ }395+396+ return refreshStatusCore(cwd).pipe(397+ Effect.ensuring(398+ SynchronizedRef.update(inFlightRefreshesRef, (current) => {399+ const next = new Map(current);400+ next.delete(cwd);401+ return next;402+ }),403+ ),404+ Effect.forkIn(broadcasterScope),405+ Effect.map((started) => {406+ const next = new Map(inFlight);407+ next.set(cwd, started);408+ return [started, next] as const;409+ }),410+ );411+ });412+ return yield* Fiber.join(fiber);413+ });
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/server/src/vcs/VcsStatusBroadcaster.ts line 498OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -381,0 +478,21 @@478+ }479+ const joined = { ...existing, pendingRerun: true };480+ const next = new Map(current);481+ next.set(cwd, joined);482+ return Effect.succeed([joined, next] as const);483+ }484+485+ return startRefreshFiber(cwd, requestGeneration).pipe(486+ Effect.map((started) => {487+ const created: InFlightRefresh = {488+ fiber: started,489+ startedGeneration: requestGeneration,490+ pendingRerun: false,491+ };492+ const next = new Map(current);493+ next.set(cwd, created);494+ return [created, next] as const;495+ }),496+ );497+ });498+ const result = yield* Fiber.join(inFlight.fiber);
- @@ -381,0 +482,21 @@482+ return Effect.succeed([joined, next] as const);483+ }484+485+ return startRefreshFiber(cwd, requestGeneration).pipe(486+ Effect.map((started) => {487+ const created: InFlightRefresh = {488+ fiber: started,489+ startedGeneration: requestGeneration,490+ pendingRerun: false,491+ };492+ const next = new Map(current);493+ next.set(cwd, created);494+ return [created, next] as const;495+ }),496+ );497+ });498+ const result = yield* Fiber.join(inFlight.fiber);499+ const latestGeneration = yield* invalidateGenerationOf(cwd);500+ if (inFlight.startedGeneration >= latestGeneration) {501+ return result;502+ }
juliusmarminge closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
d68a1441-f6bc-433a-987f-a9ddaea6ea86You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share