From 1df922ef166b38eb87949d57d90dd41325ea0f55 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Wed, 30 Dec 2020 17:18:27 +0100 Subject: [PATCH] Do file renaming first, since this is the important step, and indexing takes a while. --- src/documents/tasks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/documents/tasks.py b/src/documents/tasks.py index f9937c177..ba7010ea9 100644 --- a/src/documents/tasks.py +++ b/src/documents/tasks.py @@ -94,7 +94,10 @@ def bulk_update_documents(document_ids): documents = Document.objects.filter(id__in=document_ids) ix = index.open_index() + + for doc in documents: + post_save.send(Document, instance=doc, created=False) + with AsyncWriter(ix) as writer: for doc in documents: index.update_document(writer, doc) - post_save.send(Document, instance=doc, created=False)