From 7adf3621b7fa30d813716799ba6c1e050d3375be Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Mon, 14 Nov 2016 02:36:05 -0400 Subject: [PATCH] Remove ununsed task. --- mayan/apps/documents/literals.py | 1 - mayan/apps/documents/tasks.py | 53 +------------------------------- 2 files changed, 1 insertion(+), 53 deletions(-) diff --git a/mayan/apps/documents/literals.py b/mayan/apps/documents/literals.py index 8d8da36711..bc58ba9096 100644 --- a/mayan/apps/documents/literals.py +++ b/mayan/apps/documents/literals.py @@ -16,7 +16,6 @@ DOCUMENT_IMAGE_TASK_TIMEOUT = 20 STUB_EXPIRATION_INTERVAL = 60 * 60 * 24 # 24 hours UPDATE_PAGE_COUNT_RETRY_DELAY = 10 UPLOAD_NEW_VERSION_RETRY_DELAY = 10 -NEW_DOCUMENT_RETRY_DELAY = 10 PAGE_RANGE_ALL = 'all' PAGE_RANGE_RANGE = 'range' diff --git a/mayan/apps/documents/tasks.py b/mayan/apps/documents/tasks.py index 70309258ad..873ee89df1 100644 --- a/mayan/apps/documents/tasks.py +++ b/mayan/apps/documents/tasks.py @@ -9,8 +9,7 @@ from django.db import OperationalError from mayan.celery import app from .literals import ( - UPDATE_PAGE_COUNT_RETRY_DELAY, UPLOAD_NEW_VERSION_RETRY_DELAY, - NEW_DOCUMENT_RETRY_DELAY + UPDATE_PAGE_COUNT_RETRY_DELAY, UPLOAD_NEW_VERSION_RETRY_DELAY ) logger = logging.getLogger(__name__) @@ -85,56 +84,6 @@ def task_update_page_count(self, version_id): raise self.retry(exc=exception) -@app.task(bind=True, default_retry_delay=NEW_DOCUMENT_RETRY_DELAY, ignore_result=True) -def task_upload_new_document(self, document_type_id, shared_uploaded_file_id, description=None, label=None, language=None, user_id=None): - SharedUploadedFile = apps.get_model( - app_label='common', model_name='SharedUploadedFile' - ) - - DocumentType = apps.get_model( - app_label='documents', model_name='DocumentType' - ) - - try: - document_type = DocumentType.objects.get(pk=document_type_id) - shared_file = SharedUploadedFile.objects.get( - pk=shared_uploaded_file_id - ) - if user_id: - user = get_user_model().objects.get(pk=user_id) - else: - user = None - - except OperationalError as exception: - logger.warning( - 'Operational error during attempt to gather data for new ' - 'document: %s; Retrying.', exception - ) - raise self.retry(exc=exception) - - try: - with shared_file.open as file_object: - document_version = document_type.new_document( - self, file_object=file_object, label=label, - description=description, language=language, _user=user - ) - except OperationalError as exception: - logger.warning( - 'Operational error during attempt to gather data for new ' - 'document: %s; Retrying.', exception - ) - raise self.retry(exc=exception) - - try: - shared_file.delete() - except OperationalError as exception: - logger.warning( - 'Operational error while trying to delete shared file used to ' - 'upload new document: %s; %s. Retrying.', - document_version.document, exception - ) - - @app.task(bind=True, default_retry_delay=UPLOAD_NEW_VERSION_RETRY_DELAY, ignore_result=True) def task_upload_new_version(self, document_id, shared_uploaded_file_id, user_id, comment=None): SharedUploadedFile = apps.get_model(