diff --git a/apps/ocr/conf/settings.py b/apps/ocr/conf/settings.py index 2501653ce0..f799d301cf 100644 --- a/apps/ocr/conf/settings.py +++ b/apps/ocr/conf/settings.py @@ -3,3 +3,4 @@ from django.conf import settings TESSERACT_PATH = getattr(settings, 'OCR_TESSERACT_PATH', u'/usr/bin/tesseract') TESSERACT_LANGUAGE = getattr(settings, 'OCR_TESSERACT_LANGUAGE', None) MAX_CONCURRENT_EXECUTION = getattr(settings, 'OCR_MAX_CONCURRENT_EXECUTION', 2) +REPLICATION_DELAY = getattr(settings, 'OCR_REPLICATION_DELAY', 360) #In seconds, 360 = 6 minutes diff --git a/apps/ocr/tasks.py b/apps/ocr/tasks.py index bd82e91f81..c351164042 100644 --- a/apps/ocr/tasks.py +++ b/apps/ocr/tasks.py @@ -10,6 +10,7 @@ from literals import QUEUEDOCUMENT_STATE_PENDING, \ QUEUEDOCUMENT_STATE_ERROR from models import QueueDocument, DocumentQueue from ocr.conf.settings import MAX_CONCURRENT_EXECUTION +from ocr.conf.settings import REPLICATION_DELAY @task @@ -39,7 +40,7 @@ class DocumentQueueWatcher(PeriodicTask): if current_running_queues < MAX_CONCURRENT_EXECUTION: try: oldest_queued_document = document_queue.queuedocument_set.filter( - state=QUEUEDOCUMENT_STATE_PENDING).order_by('datetime_submitted')[0] + state=QUEUEDOCUMENT_STATE_PENDING).filter(datetime_submitted__lt=datetime.datetime.now()-datetime.timedelta(seconds=REPLICATION_DELAY)).order_by('datetime_submitted')[0] task_process_queue_document(oldest_queued_document.id).delay() except: diff --git a/docs/Changelog.txt b/docs/Changelog.txt index a1cd290674..cfc0c24396 100644 --- a/docs/Changelog.txt +++ b/docs/Changelog.txt @@ -1,5 +1,7 @@ 2011-Mar-21 -* Added a new diagnostics tab under the tools menu +* Added a new diagnostics tab under the tools menu +* Added a new option OCR_REPLICATION_DELAY to allow the storage some + time for replication before attempting to do OCR to a document 2011-Mar-20 * Added simple statistics page (total used storage, total docs, etc) diff --git a/docs/TODO b/docs/TODO index 33b3b83f7a..f4d8ad20e9 100644 --- a/docs/TODO +++ b/docs/TODO @@ -46,6 +46,7 @@ TODO, WISHLIST * Change to model signals - NOT NEEDED, found way to prevent save method recursion * Show current page in generic list template - DONE * Enable/disable ocr queue view & links - DONE +* Android App - NOT NEEDED (Use CamSanner, (C) IntSig Information Co, Ltd.) * Receive documents via email * Mobile version diff --git a/settings.py b/settings.py index 95831a69c7..1a3b99dc9d 100644 --- a/settings.py +++ b/settings.py @@ -244,6 +244,7 @@ LOGIN_EXEMPT_URLS = ( #OCR_TESSERACT_PATH = u'/usr/bin/tesseract' #OCR_MAX_CONCURRENT_EXECUTION = 2 #OCR_TESSERACT_LANGUAGE = None +#OCR_REPLICATION_DELAY = 360 # Permissions #ROLES_DEFAULT_ROLES = []