Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/git/git-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export class GitError extends Error {
}
}

const REMOTE_NAMES_CACHE_TTL_MS = 30_000;

export class GitService {
private activityLog: Array<{ command: string; timestamp: string; success: boolean; duration: number }> = [];
private cachedRemoteNames: string[] | null = null;
Expand Down Expand Up @@ -368,7 +370,8 @@ export class GitService {

private async getRemoteNames(): Promise<string[]> {
const now = Date.now();
if (this.cachedRemoteNames && now - this.remoteNamesCacheTime < 30000) {
// Remote names rarely change at runtime; addRemote/removeRemote invalidate explicitly.
if (this.cachedRemoteNames && now - this.remoteNamesCacheTime < REMOTE_NAMES_CACHE_TTL_MS) {
return this.cachedRemoteNames;
}
// Dedupe concurrent callers: if a request is already in flight, await it
Expand Down
Loading