mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-07-24 04:44:55 +00:00
Django's condition() decorator invokes etag_func and last_modified_func separately, and the view itself may resolve again -- each call to resolve_effective_document_by_pk() was redoing the same root/version DB lookups. Memoize the resolution on the request object so a single thumb/metadata/preview request resolves the effective document once instead of up to three times. Related to paperless-ngx/paperless-ngx#13161. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>