Initial implementation for generating thread JSON files

This commit is contained in:
2025-01-04 01:20:47 -05:00
parent 0f596ab5f5
commit bfe94aa2fe
8 changed files with 136 additions and 12 deletions

View File

@@ -78,8 +78,11 @@ export abstract class Iterable<T> {
throw new Error('Chunk size must be at least 1')
}
const total = await this.count()
while ( true ) {
const items = await this.range(this.index, this.index + size - 1)
// Bound the RHS index by the max # of items in case the source
// doesn't gracefully handle out-of-bounds access
const items = await this.range(this.index, Math.min(this.index + size - 1, total - 1))
this.index += items.count()
try {