Close issue #106, Convert document indexing app actions to Celery
This commit is contained in:
29
mayan/apps/document_indexing/tasks.py
Normal file
29
mayan/apps/document_indexing/tasks.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import logging
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.files import File
|
||||
|
||||
from mayan.celery import app
|
||||
from documents.models import Document
|
||||
|
||||
from .api import update_indexes, delete_indexes
|
||||
from .tools import do_rebuild_all_indexes
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@app.task(ignore_result=True)
|
||||
def task_delete_indexes(document_id):
|
||||
document = Document.objects.get(pk=document_id)
|
||||
update_indexes(document)
|
||||
|
||||
|
||||
@app.task(ignore_result=True)
|
||||
def task_update_indexes(document_id):
|
||||
document = Document.objects.get(pk=document_id)
|
||||
delete_indexes(document)
|
||||
|
||||
|
||||
@app.task(ignore_result=True)
|
||||
def task_do_rebuild_all_indexes():
|
||||
do_rebuild_all_indexes()
|
||||
Reference in New Issue
Block a user