Skip to content

Commit 440c16e

Browse files
author
yash gupta
committed
docs(github): document fetch retry backoff constants
1 parent e15a46a commit 440c16e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/github.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ interface GitHubRepo {
99
language: string | null;
1010
}
1111

12+
// Maximum number of attempts (initial + retries).
1213
const MAX_RETRIES = 3;
14+
// Initial delay in ms; doubles on each retry.
1315
const BASE_DELAY_MS = 500;
1416
const CONTRIBUTION_MILESTONES = [1, 10, 100, 250, 500, 1000];
1517
const STREAK_MILESTONES = [3, 7, 30, 100];
1618
const GRAPHQL_TIMEOUT_MS = 8000; // 8s for GraphQL endpoint
1719
const REST_TIMEOUT_MS = 5000; // 5s for REST endpoints
1820

21+
// Retry delay uses exponential backoff: delay = BASE_DELAY_MS * 2^attempt.
1922
export async function fetchWithRetry(
2023
url: string,
2124
options: RequestInit,

0 commit comments

Comments
 (0)