mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-08-21 02:03:30 +00:00
Fix: pass document chat queries as a QuerySet instead of a materialized list (#13638)
In tracemalloc based profiling, not materializing the whole Document list reduced memory to approximately 20% of the baseline, with a peak memory that scaled with the library size. Now, the lazt queryset is used and only the needed pk value is actually contributing to memory
This commit is contained in:
@@ -2267,7 +2267,7 @@ class ChatStreamingView(GenericAPIView[Any]):
|
||||
if not has_perms_owner_aware(request.user, "view_document", document):
|
||||
return HttpResponseForbidden("Insufficient permissions")
|
||||
|
||||
documents = [document]
|
||||
documents = Document.objects.filter(pk=document.pk)
|
||||
else:
|
||||
documents = Document.objects.filter(
|
||||
id__in=permitted_document_ids(request.user),
|
||||
|
||||
Reference in New Issue
Block a user