A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Corrects the timeout's interaction with files waiting to be consumed
Trenton Holmesad1f5ae08163
diff --git a/src/documents/management/commands/document_consumer.py b/src/documents/management/commands/document_consumer.pyindex 1b232c072..3a3b8a163 100644--- a/src/documents/management/commands/document_consumer.py+++ b/src/documents/management/commands/document_consumer.py@@ -248,7 +248,7 @@ class Command(BaseCommand):while not finished:try:- for event in inotify.read(timeout):+ for event in inotify.read(timeout=timeout):if recursive:path = inotify.get_path(event.wd)else:@@ -281,6 +281,15 @@ class Command(BaseCommand):# These files are still waiting to hit the timeoutnotified_files = still_waiting+ # If files are waiting, need to exit read() to check them+ # Otherwise, go back to infinite sleep time, but only if not testing+ if len(notified_files) > 0:+ timeout = inotify_debounce+ elif is_testing:+ timeout = self.testing_timeout_ms+ else:+ timeout = None+if self.stop_flag.is_set():logger.debug("Finishing because event is set")finished = Truediff --git a/src/documents/tests/test_management_consumer.py b/src/documents/tests/test_management_consumer.pyindex 71cc97be1..be8f26d12 100644--- a/src/documents/tests/test_management_consumer.py+++ b/src/documents/tests/test_management_consumer.py@@ -2,7 +2,6 @@ import filecmpimport osimport shutilfrom threading import Thread-from time import monotonicfrom time import sleepfrom unittest import mock