Skip startup full-text index purge and optimize when unnecessary
Some checks are pending
CI / Test (shard 1) (push) Waiting to run
CI / Test (shard 2) (push) Waiting to run
CI / Test (shard 3) (push) Waiting to run
CI / Test (shard 4) (push) Waiting to run
CI / Utilities Tests (push) Waiting to run
CI / Build, Upload (push) Waiting to run

purgeOrphanedContent() ran on every startup, unlike the other
data-object purges, which are gated on the purge.* prefs.
startQueueDrain() also ran an FTS5 'optimize' even when the queues were
empty.

Gate the former on purge.items and the latter on having indexed
something.
This commit is contained in:
Dan Stillman 2026-08-05 15:13:43 -04:00
parent 3af8cea1af
commit 8f6dc583b8
2 changed files with 7 additions and 2 deletions

View file

@ -1817,7 +1817,9 @@ Zotero.Fulltext = Zotero.FullText = new function () {
itemProgress.setProgress(100);
}
}
await this.optimizeContentIndex();
if (done > 0) {
await this.optimizeContentIndex();
}
// Reclaim the space freed by a rebuild (e.g., an index-format change dropping the old
// tables), which can be most of the file; the freelist gate makes this a no-op on
// ordinary startups

View file

@ -1971,7 +1971,10 @@ const { CommandLineOptions } = ChromeUtils.importESModule("chrome://zotero/conte
await Zotero.DB.executeTransaction(async function () {
return Zotero.Tags.purge();
});
await Zotero.FullText.purgeOrphanedContent();
// Items.purge() below resets the pref
if (Zotero.Prefs.get('purge.items')) {
await Zotero.FullText.purgeOrphanedContent();
}
await Zotero.Items.purge();
// DEBUG: this might not need to be permanent
//yield Zotero.DB.executeTransaction(async function () {