Deleting a document unnecessarily scans all annotations #2889
Labels
No labels
backend
critical
defect
duplicate
enhancement
fixed
frontend
general
invalid
major
minor
normal
oxjs
pandora_client
python-ox
task
trivial
wontfix
worksforme
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: 0x2620/pandora#2889
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
There is a
pre_delete
handler forDocument
which deletes the document's file.FileField.delete()
will, by default,save()
the model instance it is attached to. This is pointless if we're in the process of deleting theDocument
– and sinceDocument.save()
callsDocument.update_matches()
, this scans all annotations every time a document is deleted.3 commits on https://gitlab.com/wjt/pandora.git branch 2889-dont-save-on-delete
Diff: https://gitlab.com/wjt/pandora/compare/master...2889-dont-save-on-delete
In this brave new Django 1.9 future, these
pre_delete
hooks might want to useon_commit
to defer deleting the files until the transaction is committed: https://docs.djangoproject.com/en/1.9/topics/db/transactions/#performing-actions-after-commitIn 6e0049a/pandora: