Skip to content

Commit c2a3980

Browse files
committed
fix
1 parent ab75301 commit c2a3980

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

.github/workflows/collect-plugin-data.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
cache: 'npm'
2222

2323
- name: collect
24+
timeout-minutes: 15
2425
run: |
2526
npm install
2627
npm run plugins-directory npm-data

cmd/tasks/npm-data/list-plugins-by-query.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async function fetchPlugins(query, offset) {
1212
throw new Error(`Fetching plugins : ${response.statusText}`);
1313
}
1414

15-
return await response.json();
15+
return response.json();
1616
}
1717

1818
const ignoredScopedSet = new Set();
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
export async function fetchDownloadCount(name) {
22
await new Promise((resolve) => setTimeout(resolve, 500));
33
const response = await fetch(`https://api.npmjs.org/downloads/point/last-month/${name}`);
4+
if (response.status === 429) {
5+
await new Promise((resolve) => setTimeout(resolve, 10000));
6+
return fetchDownloadCount(name);
7+
}
8+
49
if (response.status !== 200) {
510
throw new Error(`Fetching downloads count : ${response.statusText}`);
611
}
712

8-
return await response.json();
13+
return response.json();
914
}

cmd/tasks/util/fetch-plugin.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ export async function fetchPlugin(name) {
55
throw new Error(`Fetching detailed plugin data : ${response.statusText}`);
66
}
77

8-
return await response.json();
8+
return response.json();
99
}

0 commit comments

Comments
 (0)