Skip to content

[PERF] Cache GitHub language API responses — currently refetches on every dashboard load #967

@Priyanshu-byte-coder

Description

@Priyanshu-byte-coder

Problem Statement

Language data from GitHub's /repos/{owner}/{repo}/languages endpoint is fetched fresh on every dashboard load. Language composition of a repo changes rarely — daily at most. This wastes GitHub API rate limit quota and slows down the repos widget.

Proposed Solution

Apply the existing withMetricsCache wrapper to the languages fetch with a long TTL (e.g. 6 hours). Language data for a given repo almost never changes intraday.

Alternatives Considered

  • No cache: Current behavior — wastes rate limit
  • Infinite cache: Too aggressive — user won't see new language additions

Acceptance Criteria

  • Languages fetch wrapped with withMetricsCache and TTL = 21600 seconds (6h)
  • Cache key includes repoName to avoid cross-repo collisions
  • Cache is bypassed if user clicks Refresh on the widget

Additional Context

The METRICS_CACHE_TTL_SECONDS object in src/lib/metrics-cache.ts should get a languages: 21600 entry. This follows the same pattern as all other metric caches.

Metadata

Metadata

Assignees

Labels

gssoc:assignedGSSoC: Issue assigned to a contributorlevel:intermediateGSSoC: Intermediate difficulty (35 pts)needs-triageNeeds maintainer triagetype:performanceGSSoC type bonus: performance (+15 pts)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions