Auto-vacuum when inserting/updating

This commit is contained in:
Yiorgis Gozadinos 2025-10-07 10:54:56 +03:00
parent c6eaf9d5cd
commit ce11efd17c
No known key found for this signature in database
2 changed files with 4 additions and 1 deletions

View file

@ -61,7 +61,6 @@ async def populate_db(spec: DatasetSpec) -> None:
metadata=payload.metadata,
)
progress.advance(task)
rag.store.vacuum()
def _is_relevant_match(retrieved_uri: str | None, sample: RetrievalSample) -> bool:

View file

@ -200,6 +200,8 @@ class DocumentRepository:
chunk.order = order
await self.chunk_repository.create(chunk)
# Vacuum old versions after successful creation
self.store.vacuum()
return created_doc
except Exception:
# Roll back to the captured versions and re-raise
@ -230,6 +232,8 @@ class DocumentRepository:
updated_doc.id, docling_document
)
# Vacuum old versions after successful update
self.store.vacuum()
return updated_doc
except Exception:
# Roll back to the captured versions and re-raise