Skip to content

server-core: cache + share the team GitHub snapshot (2.5min TTL, SWR) - #68

Merged
CameronCrow merged 1 commit into
mainfrom
feat/issue-66-github-snapshot-cache
Jul 20, 2026
Merged

CameronCrow merged 1 commit into
mainfrom
feat/issue-66-github-snapshot-cache

Conversation

@CameronCrow

Copy link
Copy Markdown
Owner

Summary

  • Adds a per-repoPath cache around fetchTeamGitHubSnapshot (packages/server-core/src/github-team.ts) with a 150_000ms TTL, matching the fetchGitHubPRStatus cache bumped in af80ddc.
  • Stale-while-revalidate: an expired entry is returned immediately while a single background refresh is kicked off (concurrent callers share it via single-flight dedupe); a failed refresh leaves the stale entry in place.
  • First-ever call (no cache) still awaits the live fetch.
  • The renamed inner function (fetchTeamGitHubSnapshotUncached) and its transport internals (fetchTeamIssues, fetchTeamPRs, gh exec plumbing) are untouched — the cache wraps the existing boundary so it composes cleanly with the in-process transport rewrite tracked in dashboard: replace gh/git-remote spawns with in-process GitHub REST fetch (keep-alive) #67.
  • Import-time DB-free constraint preserved (no changes to module-level side effects beyond two new Maps).

Test plan

  • bun test src/github-team.test.ts — 19 pass, 0 fail, covering: fresh miss awaits, TTL hit returns cached without spawning, stale hit returns stale + exactly one refresh under concurrent calls, refresh failure keeps serving stale.
  • bun run typecheck in packages/server-core — passes.

Closes #66

🤖 Generated with Claude Code

…shot

Activity(15s) and board(30s) dashboard polls each call
fetchTeamGitHubSnapshot separately, so every cycle could spawn up to 4 gh
processes costing 10-35s each on slow-DNS networks. Adds a per-repoPath
cache (TTL 150_000ms, matching the fetchGitHubPRStatus cache) at the
fetchTeamGitHubSnapshot boundary: a fresh miss awaits the live fetch, a
hit within TTL returns instantly, and a stale hit returns the stale
snapshot immediately while kicking a single-flight background refresh
(concurrent callers share it; a failed refresh just leaves the stale
entry in place). The transport internals (fetchTeamIssues, fetchTeamPRs)
are untouched so this composes with the in-process gh-transport rewrite.

Closes #66

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@CameronCrow
CameronCrow merged commit c4c9465 into main Jul 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dashboard: cache + share the team GitHub snapshot (2.5min TTL, stale-while-revalidate)

1 participant