fix: ensure projects that go from having no commits to having commits have sessions migrated (#5105)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Aiden Cline
2025-12-04 22:49:07 -08:00
committed by GitHub
parent a4e5a72c36
commit f950de95ba
3 changed files with 46 additions and 2 deletions

View File

@@ -17,3 +17,16 @@ export class AsyncQueue<T> implements AsyncIterable<T> {
while (true) yield await this.next()
}
}
export async function work<T>(concurrency: number, items: T[], fn: (item: T) => Promise<void>) {
const pending = [...items]
await Promise.all(
Array.from({ length: concurrency }, async () => {
while (true) {
const item = pending.pop()
if (item === undefined) return
await fn(item)
}
}),
)
}