mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-10-07 08:37:13 +00:00
Performance: pre-filter document list in scheduled workflow checks (#10031)
This commit is contained in:
1 parent
31351c5f5c
commit
422bffe1a6
3 files changed
+94
No files matched your search
@@ -33,6 +33,7 @@ from documents.data_models import DocumentMetadataOverrides
|
||||
from documents.double_sided import CollatePlugin
|
||||
from documents.file_handling import create_source_path_directory
|
||||
from documents.file_handling import generate_unique_filename
|
||||
from documents.matching import prefilter_documents_by_workflowtrigger
|
||||
from documents.models import Correspondent
|
||||
from documents.models import CustomFieldInstance
|
||||
from documents.models import Document
|
||||
@@ -473,6 +474,12 @@ def check_scheduled_workflows():
|
||||
|
||||
documents = Document.objects.filter(id__in=matched_ids)
|
||||
|
||||
if documents.count() > 0:
|
||||
documents = prefilter_documents_by_workflowtrigger(
|
||||
documents,
|
||||
trigger,
|
||||
)
|
||||
|
||||
if documents.count() > 0:
|
||||
logger.debug(
|
||||
f"Found {documents.count()} documents for trigger {trigger}",
|
||||
|
||||
Reference in new issue
Block a user