Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): keep VCS refresh responsive during slow remote lookups #13052

ClosedTamoMaes(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/13052/headopened View on GitHub

Showing 3 changed files with 221 additions and 2 deletions (loading 2).

x
0 of 3 viewed, 3 left
221 additions and 2 deletionsapps/server/src/vcs/VcsStatusBroadcaster.test.tsModified
View file
@@ -78,6 +78,7 @@
remoteInvalidationCalls: number;
remoteStatusRefreshUpstreamValues?: Array<boolean | undefined>;
backgroundWorkEnabled?: boolean;
+ beforeRemoteStatus?: Effect.Effect<void, GitManagerError>;
}) {
return VcsStatusBroadcaster.layer.pipe(
Layer.provideMerge(NodeServices.layer),
@@ -90,9 +91,10 @@
return state.currentLocalStatus;
}),
remoteStatus: (_input, options) =>
- Effect.sync(() => {
+ Effect.gen(function* () {
state.remoteStatusCalls += 1;
state.remoteStatusRefreshUpstreamValues?.push(options?.refreshUpstream);
+ yield* state.beforeRemoteStatus ?? Effect.void;
return state.currentRemoteStatus;
}),
invalidateLocalStatus: () =>
@@ -415,6 +417,224 @@
}).pipe(Effect.provide(makeTestLayer(state)));
});
​
+ it.effect("publishes local changes while an older remote refresh holds the write lock", () => {
+ const remoteStarted = Deferred.makeUnsafe<void>();
+ const releaseRemote = Deferred.makeUnsafe<void>();
+ const initialSnapshot = Deferred.makeUnsafe<void>();