mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-07-24 21:41:04 +02:00
fix: delete the DB row before the files in delete_document
File-first ordering meant a failed DB delete left a listed, 'completed' document whose files were gone — and its surviving file_hash made re-adding the same file dedup to the broken doc. DB-first (the order delete_collection already uses) degrades the same failure to harmless orphan files.
This commit is contained in:
parent
7eae8caf3a
commit
8c7f622112
1 changed files with 0 additions and 3 deletions
|
|
@ -245,9 +245,6 @@ class LocalBackend:
|
|||
|
||||
def delete_document(self, collection: str, doc_id: str) -> None:
|
||||
doc = self._require_document(collection, doc_id)
|
||||
# DB row first, files after (same order as delete_collection): a failure
|
||||
# mid-way then leaves harmless orphan files, not a listed document whose
|
||||
# files are gone.
|
||||
self._storage.delete_document(collection, doc_id)
|
||||
if doc.get("file_path"):
|
||||
Path(doc["file_path"]).unlink(missing_ok=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue