forked from CGM_Public/pretix_original
Fix memory usage in exporters by using chunked iterators
This commit is contained in:
10
src/pretix/helpers/iter.py
Normal file
10
src/pretix/helpers/iter.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import itertools
|
||||
|
||||
|
||||
def chunked_iterable(iterable, size):
|
||||
it = iter(iterable)
|
||||
while True:
|
||||
chunk = tuple(itertools.islice(it, size))
|
||||
if not chunk:
|
||||
break
|
||||
yield chunk
|
||||
Reference in New Issue
Block a user