Add locking and arbitration to indexing updates, remove filesystem index mirroring issue #56
This commit is contained in:
@@ -4,7 +4,7 @@ from mayan.celery import app
|
||||
from documents.models import Document
|
||||
from lock_manager import Lock, LockError
|
||||
|
||||
from .api import update_indexes, delete_indexes
|
||||
from .api import update_indexes, delete_empty_index_nodes
|
||||
from .tools import do_rebuild_all_indexes
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -12,13 +12,13 @@ RETRY_DELAY = 20 # TODO: convert this into a config option
|
||||
|
||||
|
||||
@app.task(ignore_result=True)
|
||||
def task_delete_indexes(document_id):
|
||||
document = Document.objects.get(pk=document_id)
|
||||
delete_indexes(document)
|
||||
def task_delete_empty_index_nodes():
|
||||
delete_empty_index_nodes()
|
||||
|
||||
|
||||
@app.task(bind=True, ignore_result=True)
|
||||
def task_update_indexes(self, document_id):
|
||||
# TODO: Add concurrent task control
|
||||
try:
|
||||
lock = Lock.acquire_lock('document_indexing_task_update_index_document_%d' % document_id)
|
||||
except LockError as exception:
|
||||
|
||||
Reference in New Issue
Block a user