mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
Update prune.py
This commit is contained in:
parent
155f53b867
commit
46288924a2
1 changed files with 2 additions and 8 deletions
|
|
@ -421,8 +421,7 @@ class ChromaDatabaseCleaner(VectorDatabaseCleaner):
|
||||||
conn.execute("DROP TABLE IF EXISTS temp_valid_fts")
|
conn.execute("DROP TABLE IF EXISTS temp_valid_fts")
|
||||||
return -1 # Signal FTS cleanup was skipped
|
return -1 # Signal FTS cleanup was skipped
|
||||||
|
|
||||||
# Step 5: Atomic FTS cleanup operation
|
# Step 5: FTS cleanup operation (already in transaction)
|
||||||
conn.execute("BEGIN IMMEDIATE")
|
|
||||||
try:
|
try:
|
||||||
# Delete all FTS content
|
# Delete all FTS content
|
||||||
conn.execute("DELETE FROM embedding_fulltext_search")
|
conn.execute("DELETE FROM embedding_fulltext_search")
|
||||||
|
|
@ -440,13 +439,8 @@ class ChromaDatabaseCleaner(VectorDatabaseCleaner):
|
||||||
# Rebuild FTS index
|
# Rebuild FTS index
|
||||||
conn.execute("INSERT INTO embedding_fulltext_search(embedding_fulltext_search) VALUES('rebuild')")
|
conn.execute("INSERT INTO embedding_fulltext_search(embedding_fulltext_search) VALUES('rebuild')")
|
||||||
|
|
||||||
# Commit the atomic operation
|
|
||||||
conn.execute("COMMIT")
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Rollback on any failure to preserve existing FTS data
|
log.error(f"FTS cleanup failed: {e}")
|
||||||
conn.execute("ROLLBACK")
|
|
||||||
log.error(f"FTS cleanup failed, rolled back changes: {e}")
|
|
||||||
conn.execute("DROP TABLE IF EXISTS temp_valid_fts")
|
conn.execute("DROP TABLE IF EXISTS temp_valid_fts")
|
||||||
return -1 # Signal FTS cleanup failed
|
return -1 # Signal FTS cleanup failed
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue