From 8dd6ab2161797f6118fb6715346ab3b0e3aba60a Mon Sep 17 00:00:00 2001 From: Shirone Date: Sat, 24 Jan 2026 22:38:50 +0100 Subject: [PATCH] fix: Extend cache TTL on GitHub PR fetch failure to prevent retry storms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Address PR #688 review feedback from CodeRabbit: When a GitHub PR fetch fails and we return stale cached data, also update the fetchedAt timestamp. This prevents the original TTL from expiring and causing every subsequent poll to retry the failing request, which would still hammer GitHub during API outages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- apps/server/src/routes/worktree/routes/list.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/server/src/routes/worktree/routes/list.ts b/apps/server/src/routes/worktree/routes/list.ts index bb9e5d8f..0f8021f1 100644 --- a/apps/server/src/routes/worktree/routes/list.ts +++ b/apps/server/src/routes/worktree/routes/list.ts @@ -255,6 +255,8 @@ async function fetchGitHubPRs( // repeated API calls during GitHub API flakiness or temporary outages if (cached) { logger.warn(`Failed to fetch GitHub PRs, returning stale cache: ${getErrorMessage(error)}`); + // Extend cache TTL to avoid repeated retries during outages + githubPRCache.set(projectPath, { prs: cached.prs, fetchedAt: Date.now() }); return cached.prs; } // No cache available, log warning and return empty map