Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3244 from pypeclub/bugfix/ftrack_chunks_avoid_inv…
Browse files Browse the repository at this point in the history
…alid_chunk_size

Ftrack: Chunk sizes for queries has minimal condition
  • Loading branch information
iLLiCiTiT authored May 26, 2022
2 parents dd6c41d + c9b0bb0 commit 8cbd2ee
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions openpype/modules/ftrack/lib/avalon_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,17 @@ def create_chunks(iterable, chunk_size=None):
list<list>: Chunked items.
"""
chunks = []
if not iterable:
return chunks

tupled_iterable = tuple(iterable)
if not tupled_iterable:
return chunks
iterable_size = len(tupled_iterable)
if chunk_size is None:
chunk_size = 200

if chunk_size < 1:
chunk_size = 1

for idx in range(0, iterable_size, chunk_size):
chunks.append(tupled_iterable[idx:idx + chunk_size])
return chunks
Expand Down

0 comments on commit 8cbd2ee

Please sign in to comment.