Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): idle Git polls no longer re-read local status when no ref moved #40093

Mergedjuliusmarmingemerged 3 commits intomain fromrefs/pull/40093/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 59 additions and 1 deletion.

x
0 of 2 viewed, 2 left
44 additions and 0 deletionsapps/server/src/vcs/VcsStatusBroadcaster.test.tsModified
View file
@@ -1332,6 +1332,50 @@
}).pipe(Effect.provide(layerTestFor(state)));
+ it.effect("a remote poll that moves no ref does not re-read local status", () => {
+ const state: Parameters<typeof layerTestFor>[0] = {
+ currentLocalStatus: baseLocalStatus,
+ currentRemoteStatus: baseRemoteStatus,
+ localStatusCalls: 0,
+ remoteStatusCalls: 0,
+ localInvalidationCalls: 0,
+ remoteInvalidationCalls: 0,
+ };
+​
+ return Effect.gen(function* () {
+ const broadcaster = yield* VcsStatusBroadcaster.VcsStatusBroadcaster;
+ yield* broadcaster.getStatus({ cwd: "/repo" });
+ const subscribed = yield* Deferred.make<void>();
+ const remoteUpdates = yield* Queue.unbounded<void>();
+ yield* broadcaster.streamStatus({ cwd: "/repo" }).pipe(
+ Stream.runForEach((event) => {
+ if (event._tag === "snapshot") return Deferred.succeed(subscribed, undefined);
+ if (event._tag === "remoteUpdated") return Queue.offer(remoteUpdates, undefined);
+ return Effect.void;
+ }),
+ Effect.forkScoped,
+ );
+ yield* Deferred.await(subscribed);
+ state.currentRemoteStatus = remoteStatusWithPr;
+ yield* TestClock.adjust("30 seconds");