Analysis was taking 60+ seconds stuck on "Fetching GitHub profile..."
- Too many API calls: Each repo was making 6-7 separate API calls
- Sequential blocking: GitHub API calls were blocking the async event loop
- Unnecessary checks: Checking commit activity and too many repos
- Before: 30 repos × 7 API calls = 210 API calls
- After: 5 repos × 2 API calls = 10 API calls
- How: Created
_detect_repo_features()that gets repo contents ONCE and checks everything from that
- Before: Checked top 30 repos in detail
- After:
- Top 10 repos total
- Only top 5 original (non-fork) repos get detailed checks
- Forks skip all detailed API calls
- Commit activity: Completely removed (was slow and not critical)
- Excessive README fetching: Only fetch 3 READMEs max
- GitHub fetch now runs in thread pool executor (doesn't block)
- Added 15-second timeout to prevent hanging
- Better error messages
- Logs show progress: "Fetching repository list...", "Processing top X repos..."
- Helps debug if still slow
Before: 60+ seconds (often timeout) After: 5-10 seconds for GitHub fetch
- User profile: 1 call
- List repos: 1 call
- 30 repos × (README + tests + dockerfile + CI + API folder + DB + notebooks): ~210 calls
- Commit activity: ~50 calls
- Total: ~262 API calls
- User profile: 1 call
- List repos: 1 call
- 5 repos × (README + contents batch): ~10 calls
- Total: ~12 API calls
98% reduction in API calls!
Restart backend and test:
cd backend
uvicorn app.main:app --reload --port 8000Check backend logs - you should see:
INFO: Fetching GitHub profile for username...
INFO: Fetching repository list...
INFO: Processing top 10 repos (out of X total)
INFO: Profile fetch complete: 10 repos processed
If still slow, check:
- GitHub token is valid (no 401 errors)
- Network connection
- Backend logs for specific errors