Skip to content

Commit

Permalink
batch index to use iterator in non test mode
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Nov 17, 2023
1 parent 16026d6 commit b350e7b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ def get_exact_or_criteria(attr, values):

@staticmethod
def batch_index(queryset, document):
for batch in queryset.order_by('-id').iterator(chunk_size=500):
document().update(batch, parallel=True)
if not get(settings, 'TEST_MODE'):
for batch in queryset.iterator(chunk_size=500):
document().update(batch, parallel=True)

@staticmethod
@transaction.atomic
Expand Down

0 comments on commit b350e7b

Please sign in to comment.