Commit 775c1232 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] Recount must be computed asynchronously.

parent 474fff2c
......@@ -185,7 +185,7 @@ def parse_extract_indexhyperdata(corpus):
session.commit()
@shared_task
def recount(corpus):
def recount(corpus_id):
"""
Recount essential metrics of the toolchain after group modifications.
......@@ -203,6 +203,7 @@ def recount(corpus):
NB: no new extraction, no list change, just the metrics
"""
corpus = session.query(Node).filter(Node.id==corpus_id).first()
# 1) we'll need the new groups and mainlist as basis
group_id = corpus.children("GROUPLIST").first().id
mainlist_id = corpus.children("MAINLIST").first().id
......
......@@ -2,6 +2,7 @@ from gargantext.util.db_cache import cache
from gargantext.util.http import ValidationException, APIView \
, HttpResponse, JsonHttpResponse
from gargantext.util.toolchain.main import recount
from gargantext.util.scheduling import scheduled
from datetime import datetime
class CorpusMetrics(APIView):
......@@ -32,7 +33,7 @@ class CorpusMetrics(APIView):
else:
t_before = datetime.now()
# =============
recount(corpus)
scheduled(recount)(corpus.id)
# =============
t_after = datetime.now()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment