mirror of
https://github.com/ddworken/hishtory.git
synced 2025-08-09 23:17:55 +02:00
Revert "Swap to using iterators for uploading to avoid storing all chunks in memory"
This reverts commit 632ecc5c81
.
This commit is contained in:
@ -122,20 +122,3 @@ func Chunks[k any](slice []k, chunkSize int) [][]k {
|
||||
}
|
||||
return chunks
|
||||
}
|
||||
|
||||
type Seq1[K any] func(yield func(K) bool) bool
|
||||
|
||||
func ChunksIter[k any](slice []k, chunkSize int) Seq1[[]k] {
|
||||
return func(yield func([]k) bool) bool {
|
||||
for i := 0; i < len(slice); i += chunkSize {
|
||||
end := i + chunkSize
|
||||
if end > len(slice) {
|
||||
end = len(slice)
|
||||
}
|
||||
if !yield(slice[i:end]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user