vacuum fts db when running check library as well

This commit is contained in:
Kovid Goyal 2022-06-20 10:19:14 +05:30
parent a4cbe12a43
commit 91b29481df
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 1 deletions

View File

@ -1282,6 +1282,8 @@ class DB:
def vacuum(self):
self.execute('VACUUM')
if self.fts_enabled:
self.fts.vacuum()
@property
def user_version(self):

View File

@ -20,7 +20,6 @@ from .pool import Pool
from .schema_upgrade import SchemaUpgrade
# TODO: calibre export/import should preserve indexed data
# TODO: check library and vacuuming of fts db
def print(*args, **kwargs):
@ -80,6 +79,10 @@ class FTS:
conn = self.get_connection()
conn.execute('DELETE FROM fts_db.dirtied_formats')
def vacuum(self):
conn = self.get_connection()
conn.execute('VACUUM')
def remove_dirty(self, book_id, fmt):
conn = self.get_connection()
conn.execute('DELETE FROM fts_db.dirtied_formats WHERE book=? AND format=?', (book_id, fmt.upper()))