Skip to content

Commit f44e0c9

Browse files
committed
OpenConceptLab/ocl_issues#2092 | Making sure collection expansion indexing triggers
1 parent 726d9eb commit f44e0c9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

core/collections/models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ def apply_parameters(self, queryset, is_concept_queryset):
11661166
def index_concepts(self):
11671167
if self.concepts.exists():
11681168
if get(settings, 'TEST_MODE', False):
1169-
index_expansion_concepts(self.id)
1169+
index_expansion_concepts(self.id, self.concepts.count())
11701170
else:
11711171
task = None
11721172
try:
@@ -1175,15 +1175,15 @@ def index_concepts(self):
11751175
name=index_expansion_concepts.__name__
11761176
)
11771177
index_expansion_concepts.apply_async(
1178-
(self.id, ), task_id=task.id, queue=task.queue, persist_args=True)
1178+
(self.id, self.concepts.count(), ), task_id=task.id, queue=task.queue, persist_args=True)
11791179
except AlreadyQueued:
11801180
if task:
11811181
task.delete()
11821182

11831183
def index_mappings(self):
11841184
if self.mappings.exists():
11851185
if get(settings, 'TEST_MODE', False):
1186-
index_expansion_mappings(self.id)
1186+
index_expansion_mappings(self.id, self.mappings.count())
11871187
else:
11881188
task = None
11891189
try:
@@ -1192,7 +1192,7 @@ def index_mappings(self):
11921192
name=index_expansion_mappings.__name__
11931193
)
11941194
index_expansion_mappings.apply_async(
1195-
(self.id, ), task_id=task.id, queue=task.queue, persist_args=True)
1195+
(self.id, self.mappings.count()), task_id=task.id, queue=task.queue, persist_args=True)
11961196
except AlreadyQueued:
11971197
if task:
11981198
task.delete()

core/common/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ def batch_index_resources(resource, filters, update_indexed=False):
559559
ignore_result=True, autoretry_for=(Exception, WorkerLostError, ), retry_kwargs={'max_retries': 2, 'countdown': 2},
560560
acks_late=True, reject_on_worker_lost=True, base=QueueOnceCustomTask
561561
)
562-
def index_expansion_concepts(expansion_id):
562+
def index_expansion_concepts(expansion_id, count=None): # pylint: disable=unused-argument
563563
from core.collections.models import Expansion
564564
expansion = Expansion.objects.filter(id=expansion_id).first()
565565
if expansion:
@@ -571,7 +571,7 @@ def index_expansion_concepts(expansion_id):
571571
ignore_result=True, autoretry_for=(Exception, WorkerLostError, ), retry_kwargs={'max_retries': 2, 'countdown': 2},
572572
acks_late=True, reject_on_worker_lost=True, base=QueueOnceCustomTask
573573
)
574-
def index_expansion_mappings(expansion_id):
574+
def index_expansion_mappings(expansion_id, count=None):
575575
from core.collections.models import Expansion
576576
expansion = Expansion.objects.filter(id=expansion_id).first()
577577
if expansion:

0 commit comments

Comments
 (0)