Process issues sequentially to avoid rate limits

pull/19053/head
Dax Raad 2026-03-24 23:54:27 -04:00
parent 45c2573979
commit be142b00bd
1 changed files with 9 additions and 4 deletions

View File

@ -58,6 +58,7 @@ async function main() {
const all = (await res.json()) as Issue[] const all = (await res.json()) as Issue[]
if (all.length === 0) break if (all.length === 0) break
console.log(`Fetched page ${page} ${all.length} issues`)
const stale: number[] = [] const stale: number[] = []
for (const i of all) { for (const i of all) {
@ -67,8 +68,10 @@ async function main() {
} else { } else {
console.log(`\nFound fresh issue #${i.number}, stopping`) console.log(`\nFound fresh issue #${i.number}, stopping`)
if (stale.length > 0) { if (stale.length > 0) {
await Promise.all(stale.map(close)) for (const num of stale) {
closed += stale.length await close(num)
closed++
}
} }
console.log(`Closed ${closed} issues total`) console.log(`Closed ${closed} issues total`)
return return
@ -76,8 +79,10 @@ async function main() {
} }
if (stale.length > 0) { if (stale.length > 0) {
await Promise.all(stale.map(close)) for (const num of stale) {
closed += stale.length await close(num)
closed++
}
} }
page++ page++