GitHub's statistics endpoints (/stats/commit_activity, /stats/code_frequency, /stats/participation) return 202 Accepted when data is being computed for the first time. The current code treats this as a success, but the response body is empty/incomplete.
This causes the Analytics tab to show "no data" on first visit to repos that haven't been analyzed yet.
Suggested implementation:
js
if (response.status === 202) {
// GitHub is computing stats — wait and retry
await new Promise(r => setTimeout(r, 2000));
return fetchWithRetry(url, options, retriesLeft - 1);
}
Add a max retry count (e.g., 3 attempts) to avoid infinite loops.
GitHub's statistics endpoints (/stats/commit_activity, /stats/code_frequency, /stats/participation) return 202 Accepted when data is being computed for the first time. The current code treats this as a success, but the response body is empty/incomplete.
This causes the Analytics tab to show "no data" on first visit to repos that haven't been analyzed yet.
Suggested implementation:
js
if (response.status === 202) {
// GitHub is computing stats — wait and retry
await new Promise(r => setTimeout(r, 2000));
return fetchWithRetry(url, options, retriesLeft - 1);
}
Add a max retry count (e.g., 3 attempts) to avoid infinite loops.