Skip to content

Handle GitHub Stats API 202 responses with retry logic #37

Description

@AditthyaSS

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions