mirror of
https://fastgit.cc/https://github.com/anomalyco/opencode
synced 2026-04-21 05:10:58 +08:00
Process issues sequentially to avoid rate limits
This commit is contained in:
@@ -58,6 +58,7 @@ async function main() {
|
||||
|
||||
const all = (await res.json()) as Issue[]
|
||||
if (all.length === 0) break
|
||||
console.log(`Fetched page ${page} ${all.length} issues`)
|
||||
|
||||
const stale: number[] = []
|
||||
for (const i of all) {
|
||||
@@ -67,8 +68,10 @@ async function main() {
|
||||
} else {
|
||||
console.log(`\nFound fresh issue #${i.number}, stopping`)
|
||||
if (stale.length > 0) {
|
||||
await Promise.all(stale.map(close))
|
||||
closed += stale.length
|
||||
for (const num of stale) {
|
||||
await close(num)
|
||||
closed++
|
||||
}
|
||||
}
|
||||
console.log(`Closed ${closed} issues total`)
|
||||
return
|
||||
@@ -76,8 +79,10 @@ async function main() {
|
||||
}
|
||||
|
||||
if (stale.length > 0) {
|
||||
await Promise.all(stale.map(close))
|
||||
closed += stale.length
|
||||
for (const num of stale) {
|
||||
await close(num)
|
||||
closed++
|
||||
}
|
||||
}
|
||||
|
||||
page++
|
||||
|
||||
Reference in New Issue
Block a user