From b350e7b948c045a2337565d83a1184c5b6e478ab Mon Sep 17 00:00:00 2001 From: Sny Date: Fri, 17 Nov 2023 15:11:50 +0530 Subject: [PATCH] batch index to use iterator in non test mode --- core/common/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/common/models.py b/core/common/models.py index 451b57afc..2f1822865 100644 --- a/core/common/models.py +++ b/core/common/models.py @@ -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