Skip to content
TypeScript

fix(server): a zero Git fetch interval also stops the fetch on window focus (#13253)

Igor Makowski51cb8481a9e0
diff --git a/apps/server/src/git/GitManager.test.ts b/apps/server/src/git/GitManager.test.ts
index d1ff007a4fc..b9a1d84fdcb 100644
--- a/apps/server/src/git/GitManager.test.ts
+++ b/apps/server/src/git/GitManager.test.ts
@@ -902,6 +902,12 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
);
const broadcasterContext = yield* Layer.build(
VcsStatusBroadcaster.layer.pipe(
+ Layer.provide(
+ Layer.succeed(
+ VcsStatusBroadcaster.VcsAutomaticFetchInterval,
+ Effect.succeed(Duration.seconds(1)),
+ ),
+ ),
Layer.provide(
Layer.succeed(
GitWorkflowService.GitWorkflowService,
@@ -927,10 +933,7 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
let snapshotCount = 0;
for (const cwd of [repoDir, worktreeDir]) {
yield* Stream.runForEach(
- broadcaster.streamStatus(
- { cwd, includeRemote: false },
- { automaticRemoteRefreshInterval: Effect.succeed(Duration.seconds(1)) },
- ),
+ broadcaster.streamStatus({ cwd, includeRemote: false }),
(event) => {
if (
cwd === worktreeDir &&
diff --git a/apps/server/src/server.ts b/apps/server/src/server.ts
index 2997b724173..f8415f3d8c9 100644
--- a/apps/server/src/server.ts
+++ b/apps/server/src/server.ts
@@ -401,6 +401,7 @@ const layerVcs = Layer.empty.pipe(
Layer.provideMerge(
VcsStatusBroadcaster.layer.pipe(
Layer.provide(layerGitWorkflow),
+ Layer.provide(VcsStatusBroadcaster.layerAutomaticFetchInterval),
// The orchestration runtime also consumes the broadcaster (run
// finalization), so the policy cannot read the store from the runtime's
// output.
diff --git a/apps/server/src/vcs/VcsStatusBroadcaster.test.ts b/apps/server/src/vcs/VcsStatusBroadcaster.test.ts
index c8fe9dca16f..22ad05d20ac 100644
--- a/apps/server/src/vcs/VcsStatusBroadcaster.test.ts
+++ b/apps/server/src/vcs/VcsStatusBroadcaster.test.ts
@@ -79,11 +79,18 @@ function layerTestFor(state: {
remoteInvalidationCalls: number;
remoteStatusRefreshUpstreamValues?: Array<boolean | undefined>;
backgroundWorkEnabled?: boolean;
+ automaticFetchInterval?: Effect.Effect<Duration.Duration>;
beforeRemoteStatus?: Effect.Effect<void>;
}) {
return VcsStatusBroadcaster.layer.pipe(
Layer.provideMerge(NodeServices.layer),
Layer.provide(layerBackgroundPolicy(() => state.backgroundWorkEnabled !== false)),
+ Layer.provide(
+ Layer.succeed(
+ VcsStatusBroadcaster.VcsAutomaticFetchInterval,
+ state.automaticFetchInterval ?? Effect.succeed(Duration.seconds(30)),
+ ),
+ ),
Layer.provide(
Layer.mock(GitWorkflowService.GitWorkflowService)({
localStatus: () =>
@@ -212,6 +219,93 @@ describe("VcsStatusBroadcaster", () => {
},
);
+ it.effect.each(["status refresh", "initial stream"] as const)(
+ "%s updates local and PR status without fetching or pulling when the interval is zero",
+ (entryPoint) => {
+ let interval = Duration.zero;
+ let pullCalls = 0;
+ let invalidations = 0;
+ const refreshUpstreamValues: Array<boolean | undefined> = [];
+ const local: VcsStatusLocalResult = {
+ ...baseLocalStatus,
+ isDefaultRef: true,
+ refName: "main",
+ };
+ const remote = { ...remoteStatusWithPr, behindCount: 2 };
+ const testLayer = VcsStatusBroadcaster.layer.pipe(
+ Layer.provideMerge(NodeServices.layer),
+ Layer.provide(
+ Layer.succeed(
+ VcsStatusBroadcaster.VcsAutomaticFetchInterval,
+ Effect.sync(() => interval),
+ ),
+ ),
+ Layer.provide(layerBackgroundPolicy(() => true)),
+ Layer.provide(
+ Layer.succeed(VcsStatusBroadcaster.VcsAutoPullPolicy, {
+ isEnabled: () => Effect.succeed(true),
+ }),
+ ),
+ Layer.provide(
+ Layer.mock(GitWorkflowService.GitWorkflowService)({
+ localStatus: () => Effect.succeed(local),
+ remoteStatus: (_input, options) =>
+ Effect.sync(() => {
+ refreshUpstreamValues.push(options?.refreshUpstream);
+ return remote;
+ }),
+ invalidateLocalStatus: () => Effect.void,
+ invalidateRemoteStatus: () => Effect.void,
+ invalidateStatus: () =>
+ Effect.sync(() => {
+ invalidations += 1;
+ }),
+ pullCurrentBranch: () =>
+ Effect.sync(() => {
+ pullCalls += 1;
+ return { status: "pulled" as const, refName: "main", upstreamRef: "origin/main" };
+ }),
+ }),
+ ),
+ );
+
+ return Effect.gen(function* () {
+ const broadcaster = yield* VcsStatusBroadcaster.VcsStatusBroadcaster;
+ if (entryPoint === "status refresh") {
+ const status = yield* broadcaster.refreshStatus("/repo");
+ assert.deepStrictEqual(status, { ...local, ...remote });
+ assert.equal(invalidations, 1);
+ } else {
+ const update = yield* broadcaster.streamStatus({ cwd: "/repo" }).pipe(
+ Stream.filter(
+ (event) =>
+ event._tag === "remoteUpdated" ||
+ (event._tag === "snapshot" && event.remote !== null),
+ ),
+ Stream.runHead,
+ );
+ assert.deepStrictEqual(Option.getOrThrow(update), {
+ _tag: "remoteUpdated",
+ remote,
+ });
+ assert.deepStrictEqual(yield* broadcaster.getStatus({ cwd: "/repo" }), {
+ ...local,
+ ...remote,
+ });
+ }
+ assert.deepStrictEqual(refreshUpstreamValues, [false]);
+ assert.equal(pullCalls, 0);
+
+ if (entryPoint === "status refresh") {
+ interval = Duration.minutes(1);
+ yield* broadcaster.refreshStatus("/repo");
+ assert.deepStrictEqual(refreshUpstreamValues, [false, true, false]);
+ assert.equal(pullCalls, 1);
+ }
+ }).pipe(Effect.provide(testLayer));
+ },
+ );
+
it.effect.each([
{ refresh: "explicit", failure: "pull" },
{ refresh: "explicit", failure: "post-pull remote read" },
@@ -778,6 +872,7 @@ describe("VcsStatusBroadcaster", () => {
currentRemoteStatus: remoteStatusWithPr,
localStatusCalls: 0,
remoteStatusCalls: 0,
+ automaticFetchInterval: Effect.succeed(Duration.zero),
localInvalidationCalls: 0,
remoteInvalidationCalls: 0,
remoteStatusRefreshUpstreamValues: [] as Array<boolean | undefined>,
@@ -788,21 +883,15 @@ describe("VcsStatusBroadcaster", () => {
const scope = yield* Scope.make();
const snapshotDeferred = yield* Deferred.make<VcsStatusStreamEvent>();
const remoteUpdatedDeferred = yield* Deferred.make<VcsStatusStreamEvent>();
- yield* Stream.runForEach(
- broadcaster.streamStatus(
- { cwd: "/repo" },
- { automaticRemoteRefreshInterval: Effect.succeed(Duration.zero) },
- ),
- (event) => {
- if (event._tag === "snapshot") {
- return Deferred.succeed(snapshotDeferred, event).pipe(Effect.ignore);
- }
- if (event._tag === "remoteUpdated") {
- return Deferred.succeed(remoteUpdatedDeferred, event).pipe(Effect.ignore);
- }
- return Effect.void;
- },
- ).pipe(Effect.forkIn(scope));
+ yield* Stream.runForEach(broadcaster.streamStatus({ cwd: "/repo" }), (event) => {
+ if (event._tag === "snapshot") {
+ return Deferred.succeed(snapshotDeferred, event).pipe(Effect.ignore);
+ }
+ if (event._tag === "remoteUpdated") {
+ return Deferred.succeed(remoteUpdatedDeferred, event).pipe(Effect.ignore);
+ }
+ return Effect.void;
+ }).pipe(Effect.forkIn(scope));
const snapshot = yield* Deferred.await(snapshotDeferred);
const remoteUpdated = yield* Deferred.await(remoteUpdatedDeferred);
@@ -846,6 +935,12 @@ describe("VcsStatusBroadcaster", () => {
let firstRemoteAttemptDeferred: Deferred.Deferred<void> | null = null;
const layerTest = VcsStatusBroadcaster.layer.pipe(
Layer.provideMerge(NodeServices.layer),
+ Layer.provide(
+ Layer.succeed(
+ VcsStatusBroadcaster.VcsAutomaticFetchInterval,
+ Effect.succeed(Duration.zero),
+ ),
+ ),
Layer.provide(layerBackgroundPolicy(() => true)),
Layer.provide(
Layer.mock(GitWorkflowService.GitWorkflowService)({
@@ -893,15 +988,10 @@ describe("VcsStatusBroadcaster", () => {
const scope = yield* Scope.make();
firstRemoteAttemptDeferred = yield* Deferred.make<void>();
const remoteUpdatedDeferred = yield* Deferred.make<VcsStatusStreamEvent>();
- yield* Stream.runForEach(
- broadcaster.streamStatus(
- { cwd: privateCwd },
- { automaticRemoteRefreshInterval: Effect.succeed(Duration.zero) },
- ),
- (event) =>
- event._tag === "remoteUpdated"
- ? Deferred.succeed(remoteUpdatedDeferred, event).pipe(Effect.ignore)
- : Effect.void,
+ yield* Stream.runForEach(broadcaster.streamStatus({ cwd: privateCwd }), (event) =>
+ event._tag === "remoteUpdated"
+ ? Deferred.succeed(remoteUpdatedDeferred, event).pipe(Effect.ignore)
+ : Effect.void,
).pipe(Effect.forkIn(scope));
yield* Deferred.await(firstRemoteAttemptDeferred);
@@ -955,6 +1045,7 @@ describe("VcsStatusBroadcaster", () => {
currentRemoteStatus: baseRemoteStatus,
localStatusCalls: 0,
remoteStatusCalls: 0,
+ automaticFetchInterval: Effect.succeed(Duration.minutes(1)),
localInvalidationCalls: 0,
remoteInvalidationCalls: 0,
};
@@ -964,15 +1055,10 @@ describe("VcsStatusBroadcaster", () => {
yield* broadcaster.getStatus({ cwd: "/repo" });
const scope = yield* Scope.make();
const snapshotDeferred = yield* Deferred.make<VcsStatusStreamEvent>();
- yield* Stream.runForEach(
- broadcaster.streamStatus(
- { cwd: "/repo" },
- { automaticRemoteRefreshInterval: Effect.succeed(Duration.minutes(1)) },
- ),
- (event) =>
- event._tag === "snapshot"
- ? Deferred.succeed(snapshotDeferred, event).pipe(Effect.ignore)
- : Effect.void,
+ yield* Stream.runForEach(broadcaster.streamStatus({ cwd: "/repo" }), (event) =>
+ event._tag === "snapshot"
+ ? Deferred.succeed(snapshotDeferred, event).pipe(Effect.ignore)
+ : Effect.void,
).pipe(Effect.forkIn(scope));
yield* Deferred.await(snapshotDeferred);
@@ -1000,6 +1086,7 @@ describe("VcsStatusBroadcaster", () => {
currentRemoteStatus: initialRemote as VcsStatusRemoteResult | null,
localStatusCalls: 0,
remoteStatusCalls: 0,
+ automaticFetchInterval: Effect.succeed(Duration.minutes(1)),
localInvalidationCalls: 0,
remoteInvalidationCalls: 0,
};
@@ -1010,17 +1097,12 @@ describe("VcsStatusBroadcaster", () => {
const scope = yield* Scope.make();
const snapshotDeferred = yield* Deferred.make<VcsStatusStreamEvent>();
const localUpdatedDeferred = yield* Deferred.make<VcsStatusStreamEvent>();
- yield* Stream.runForEach(
- broadcaster.streamStatus(
- { cwd: "/repo" },
- { automaticRemoteRefreshInterval: Effect.succeed(Duration.minutes(1)) },
- ),
- (event) =>
- event._tag === "snapshot"
- ? Deferred.succeed(snapshotDeferred, event).pipe(Effect.ignore)
- : event._tag === "localUpdated"
- ? Deferred.succeed(localUpdatedDeferred, event).pipe(Effect.ignore)
- : Effect.void,
+ yield* Stream.runForEach(broadcaster.streamStatus({ cwd: "/repo" }), (event) =>
+ event._tag === "snapshot"
+ ? Deferred.succeed(snapshotDeferred, event).pipe(Effect.ignore)
+ : event._tag === "localUpdated"
+ ? Deferred.succeed(localUpdatedDeferred, event).pipe(Effect.ignore)
+ : Effect.void,
).pipe(Effect.forkIn(scope));
yield* Deferred.await(snapshotDeferred);
@@ -1127,6 +1209,12 @@ describe("VcsStatusBroadcaster", () => {
};
const layerTest = VcsStatusBroadcaster.layer.pipe(
Layer.provideMerge(NodeServices.layer),
+ Layer.provide(
+ Layer.succeed(
+ VcsStatusBroadcaster.VcsAutomaticFetchInterval,
+ Effect.succeed(Duration.seconds(1)),
+ ),
+ ),
Layer.provide(layerBackgroundPolicy(() => false)),
Layer.provide(
Layer.mock(GitWorkflowService.GitWorkflowService)({
@@ -1154,12 +1242,7 @@ describe("VcsStatusBroadcaster", () => {
return Effect.gen(function* () {
const broadcaster = yield* VcsStatusBroadcaster.VcsStatusBroadcaster;
- const snapshot = yield* Stream.runHead(
- broadcaster.streamStatus(
- { cwd: "/repo" },
- { automaticRemoteRefreshInterval: Effect.succeed(Duration.seconds(1)) },
- ),
- );
+ const snapshot = yield* Stream.runHead(broadcaster.streamStatus({ cwd: "/repo" }));
assert.isTrue(Option.isSome(snapshot));
assert.equal(state.remoteStatusCalls, 0);
diff --git a/apps/server/src/vcs/VcsStatusBroadcaster.ts b/apps/server/src/vcs/VcsStatusBroadcaster.ts
index 2bfdbfbe7cd..fec9f74b466 100644
--- a/apps/server/src/vcs/VcsStatusBroadcaster.ts
+++ b/apps/server/src/vcs/VcsStatusBroadcaster.ts
@@ -21,6 +21,8 @@ import type {
VcsStatusStreamEvent,
VcsStatusSubscriptionInput,
} from "@t3tools/contracts";
+import { DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL } from "@t3tools/contracts";
+import { resolveServerBackgroundActivitySettings } from "@t3tools/shared/backgroundActivitySettings";
import { mergeGitStatusParts } from "@t3tools/shared/git";
import * as KeyedLock from "@t3tools/shared/KeyedLock";
import { resolveProjectSettings } from "@t3tools/shared/projectSettings";
@@ -30,7 +32,6 @@ import * as GitWorkflowService from "../git/GitWorkflowService.ts";
import * as ProjectStore from "../orchestration-v2/ProjectStore.ts";
import * as ServerSettings from "../serverSettings.ts";
-const DEFAULT_VCS_STATUS_REFRESH_INTERVAL = Duration.seconds(30);
const VCS_STATUS_REFRESH_FAILURE_BASE_DELAY = Duration.seconds(30);
const VCS_STATUS_REFRESH_FAILURE_MAX_DELAY = Duration.minutes(15);
const MAX_FAILURE_DIAGNOSTIC_VALUES = 8;
@@ -140,9 +141,23 @@ interface ActiveRemotePoller {
readonly demandCwds: Ref.Ref<ReadonlyMap<string, number>>;
}
-interface StreamStatusOptions {
- readonly automaticRemoteRefreshInterval?: Effect.Effect<Duration.Duration, never>;
-}
+export class VcsAutomaticFetchInterval extends Context.Reference<Effect.Effect<Duration.Duration>>(
+ "t3/vcs/VcsAutomaticFetchInterval",
+ { defaultValue: () => Effect.succeed(DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL) },
+) {}
+
+export const layerAutomaticFetchInterval = Layer.effect(
+ VcsAutomaticFetchInterval,
+ Effect.gen(function* () {
+ const serverSettings = yield* ServerSettings.ServerSettingsService;
+ return serverSettings.getSettings.pipe(
+ Effect.map(
+ (settings) => resolveServerBackgroundActivitySettings(settings).automaticGitFetchInterval,
+ ),
+ Effect.orElseSucceed(() => DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL),
+ );
+ }),
+);
export class VcsAutoPullPolicy extends Context.Reference<{
readonly isEnabled: (cwd: string) => Effect.Effect<boolean, never>;
@@ -198,7 +213,6 @@ export class VcsStatusBroadcaster extends Context.Service<
) => Effect.Effect<VcsStatusRemoteResult | null, GitManagerServiceError>;
readonly streamStatus: (
input: VcsStatusSubscriptionInput,
- options?: StreamStatusOptions,
) => Stream.Stream<VcsStatusStreamEvent, GitManagerServiceError>;
}
>()("t3/vcs/VcsStatusBroadcaster") {}
@@ -215,6 +229,7 @@ const normalizeCwd = (cwd: string) =>
/** @public Service construction is part of the canonical Effect module API. */
export const make = Effect.gen(function* () {
+ const automaticFetchInterval = yield* VcsAutomaticFetchInterval;
const autoPullPolicy = yield* VcsAutoPullPolicy;
const workflow = yield* GitWorkflowService.GitWorkflowService;
const backgroundPolicy = yield* BackgroundPolicy.BackgroundPolicy;
@@ -374,10 +389,13 @@ export const make = Effect.gen(function* () {
cwd,
Effect.gen(function* () {
const latest = yield* getCachedStatus(cwd);
+ const refreshUpstream = !Duration.isZero(yield* automaticFetchInterval);
const [local, remote] = yield* Effect.all(
[
latest?.local ? Effect.succeed(latest.local.value) : workflow.localStatus({ cwd }),
- latest?.remote ? Effect.succeed(latest.remote.value) : workflow.remoteStatus({ cwd }),
+ latest?.remote
+ ? Effect.succeed(latest.remote.value)
+ : workflow.remoteStatus({ cwd }, { refreshUpstream }),
],
{ concurrency: "unbounded" },
);
@@ -468,7 +486,10 @@ export const make = Effect.gen(function* () {
}
const previousRemote = (yield* getCachedStatus(cwd))?.remote?.value;
const remote = yield* workflow.remoteStatus({ cwd }, options);
- const pulled = yield* maybeAutoPull(cwd, remote, options?.policyCwds ?? [cwd]);
+ const pulled =
+ options?.refreshUpstream === false
+ ? null
+ : yield* maybeAutoPull(cwd, remote, options?.policyCwds ?? [cwd]);
if (pulled !== null) return pulled.remote;
if (
remote &&
@@ -493,11 +514,13 @@ export const make = Effect.gen(function* () {
return yield* withRemoteWriteLock(
cwd,
Effect.gen(function* () {
+ const refreshUpstream = !Duration.isZero(yield* automaticFetchInterval);
yield* workflow.invalidateStatus(cwd);
// Local after remote: the fetch can move the base that the Changes totals compare with.
- const remote = yield* workflow.remoteStatus({ cwd });
+ const remote = yield* workflow.remoteStatus({ cwd }, { refreshUpstream });
const local = yield* workflow.localStatus({ cwd });
- const pulled = yield* maybeAutoPull(cwd, remote, [rawCwd]);
+ // Without a fetch, the cached behind count cannot justify an automatic pull.
+ const pulled = refreshUpstream ? yield* maybeAutoPull(cwd, remote, [rawCwd]) : null;
if (pulled !== null) return mergeGitStatusParts(pulled.local, pulled.remote);
return yield* updateCachedStatus(cwd, local, remote, { publish: true });
}),
@@ -535,16 +558,15 @@ export const make = Effect.gen(function* () {
const makeRemoteRefreshLoop = (
cwd: string,
demandCwdsRef: Ref.Ref<ReadonlyMap<string, number>>,
- automaticRemoteRefreshInterval: Effect.Effect<Duration.Duration, never>,
refreshImmediately: boolean,
) => {
return Effect.gen(function* () {
const consecutiveFailuresRef = yield* Ref.make(0);
const needsInitialRefreshRef = yield* Ref.make(refreshImmediately);
const refreshRemoteStatusIfEnabled = Effect.gen(function* () {
- const configuredInterval = yield* automaticRemoteRefreshInterval;
+ const configuredInterval = yield* automaticFetchInterval;
const activeInterval = Duration.isZero(configuredInterval)
- ? DEFAULT_VCS_STATUS_REFRESH_INTERVAL
+ ? DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL
: configuredInterval;
const needsInitialRefresh = yield* Ref.get(needsInitialRefreshRef);
if (Duration.isZero(configuredInterval) && !needsInitialRefresh) {
@@ -597,10 +619,10 @@ export const make = Effect.gen(function* () {
});
if (!refreshImmediately) {
- const configuredInterval = yield* automaticRemoteRefreshInterval;
+ const configuredInterval = yield* automaticFetchInterval;
yield* Effect.sleep(
Duration.isZero(configuredInterval)
- ? DEFAULT_VCS_STATUS_REFRESH_INTERVAL
+ ? DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL
: configuredInterval,
);
}
@@ -619,7 +641,6 @@ export const make = Effect.gen(function* () {
const retainRemotePoller = Effect.fn("VcsStatusBroadcaster.retainRemotePoller")(function* (
cwd: string,
demandCwd: string,
- automaticRemoteRefreshInterval: Effect.Effect<Duration.Duration, never>,
refreshImmediately: boolean,
) {
yield* SynchronizedRef.modifyEffect(pollersRef, (activePollers) => {
@@ -643,12 +664,7 @@ export const make = Effect.gen(function* () {
return Ref.make<ReadonlyMap<string, number>>(new Map([[demandCwd, 1]])).pipe(
Effect.flatMap((demandCwds) =>
- makeRemoteRefreshLoop(
- cwd,
- demandCwds,
- automaticRemoteRefreshInterval,
- refreshImmediately,
- ).pipe(
+ makeRemoteRefreshLoop(cwd, demandCwds, refreshImmediately).pipe(
Effect.forkIn(broadcasterScope),
Effect.map((fiber) => {
const nextPollers = new Map(activePollers);
@@ -707,7 +723,7 @@ export const make = Effect.gen(function* () {
}
});
- const streamStatus: VcsStatusBroadcaster["Service"]["streamStatus"] = (input, options) =>
+ const streamStatus: VcsStatusBroadcaster["Service"]["streamStatus"] = (input) =>
Stream.unwrap(
Effect.gen(function* () {
const cwd = yield* withFileSystem(normalizeCwd(input.cwd));
@@ -719,8 +735,6 @@ export const make = Effect.gen(function* () {
yield* retainRemotePoller(
cwd,
input.cwd,
- options?.automaticRemoteRefreshInterval ??
- Effect.succeed(DEFAULT_VCS_STATUS_REFRESH_INTERVAL),
cachedStatus?.remote === null || cachedStatus?.remote === undefined,
);
}
diff --git a/apps/server/src/ws.ts b/apps/server/src/ws.ts
index ea489a886d4..976f0229de3 100644
--- a/apps/server/src/ws.ts
+++ b/apps/server/src/ws.ts
@@ -21,7 +21,6 @@ import { rpcInitialItems } from "./rpcInitialItems.ts";
import { subscribeChatGptHandoff } from "./provider/CodexChatGptHandoff.ts";
import { subscribeCodexAuthCallback } from "./provider/CodexAuthCallback.ts";
import {
- DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL,
AcpRegistryOperationError,
CommandId,
authScopeResponse,
@@ -100,7 +99,6 @@ import {
WS_METHODS,
WsRpcGroup,
} from "@t3tools/contracts";
-import { resolveServerBackgroundActivitySettings } from "@t3tools/shared/backgroundActivitySettings";
import {
HttpRouter,
HttpServerRequest,
@@ -1284,16 +1282,6 @@ const layerWsRpc = (
const serverAuth = yield* EnvironmentAuth.EnvironmentAuth;
const sourceControlDiscovery = yield* SourceControlDiscovery.SourceControlDiscovery;
const otlpEndpointCheck = yield* OtlpEndpointCheck.OtlpEndpointCheck;
- const automaticGitFetchInterval = serverSettings.getSettings.pipe(
- Effect.map(
- (settings) => resolveServerBackgroundActivitySettings(settings).automaticGitFetchInterval,
- ),
- Effect.catch((cause) =>
- Effect.logWarning("Failed to read automatic Git fetch interval setting", {
- detail: cause.message,
- }).pipe(Effect.as(DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL)),
- ),
- );
const sourceControlRepositories =
yield* SourceControlRepositoryService.SourceControlRepositoryService;
const withPullRequestViewer = pullRequests.withRoutingCredential;
@@ -2752,10 +2740,7 @@ const layerWsRpc = (
}),
[WS_METHODS.assetsPersistChatAttachments]: (input) =>
persistChatAttachments(input).pipe(Effect.map((attachments) => ({ attachments }))),
- [WS_METHODS.subscribeVcsStatus]: (input) =>
- vcsStatusBroadcaster.streamStatus(input, {
- automaticRemoteRefreshInterval: automaticGitFetchInterval,
- }),
+ [WS_METHODS.subscribeVcsStatus]: (input) => vcsStatusBroadcaster.streamStatus(input),
[WS_METHODS.subscribeWorktreeSetup]: (input) => worktreeSetupTracker.stream(input.threadId),
[WS_METHODS.worktreeSetupCancel]: (input) =>
worktreeSetupTracker