Skip to content

Commit be142b0

Browse files
committed
Process issues sequentially to avoid rate limits
1 parent 45c2573 commit be142b0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

script/github/close-issues.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ async function main() {
5858

5959
const all = (await res.json()) as Issue[]
6060
if (all.length === 0) break
61+
console.log(`Fetched page ${page} ${all.length} issues`)
6162

6263
const stale: number[] = []
6364
for (const i of all) {
@@ -67,17 +68,21 @@ async function main() {
6768
} else {
6869
console.log(`\nFound fresh issue #${i.number}, stopping`)
6970
if (stale.length > 0) {
70-
await Promise.all(stale.map(close))
71-
closed += stale.length
71+
for (const num of stale) {
72+
await close(num)
73+
closed++
74+
}
7275
}
7376
console.log(`Closed ${closed} issues total`)
7477
return
7578
}
7679
}
7780

7881
if (stale.length > 0) {
79-
await Promise.all(stale.map(close))
80-
closed += stale.length
82+
for (const num of stale) {
83+
await close(num)
84+
closed++
85+
}
8186
}
8287

8388
page++

0 commit comments

Comments
 (0)