Skip to content

Commit 0b62d3b

Browse files
committed
Update fetcher.ts to increase minTimeout to 3000ms and set retries to 3 for improved request resilience. Remove error handling for NPM API response in libraries.ts to streamline data fetching process.
1 parent 78fa4a5 commit 0b62d3b

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

lib/fetcher.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ const throttledFetch = throttler(async (url: string) => {
4545
};
4646

4747
return await pRetry(fn, {
48-
minTimeout: 2000,
48+
minTimeout: 3000,
4949
factor: 1,
50+
retries: 3,
5051
onFailedAttempt: (err) => {
5152
console.log(
5253
"fetcher: failed %s, attempt number = %d, retries left = %d",

lib/libraries.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,6 @@ export const getLibraries = async (): Promise<LibraryInfo[]> => {
186186
const res = await fetcher(
187187
`https://api.npmjs.org/downloads/point/last-week/${name}`,
188188
);
189-
if (!res.ok) {
190-
throw new Error(`NPM API error for (${name}): ${res.status}`);
191-
}
192189
const data: any = res.data;
193190
const npm = {
194191
url: `https://www.npmjs.com/package/${name}`,

0 commit comments

Comments
 (0)