perf(12-02): skip FTS5 rebuild during library removal
Contentless FTS5 cannot delete individual rows, but stale entries are filtered out by the JOIN against track_metadata in search queries. The index is rebuilt on the next full rescan. Removes ~10s of overhead for a 25K-track library removal.
This commit is contained in:
@@ -437,10 +437,12 @@ func (l *Library) RemoveLibrary(id int64) (*RemovalSummary, error) {
|
|||||||
|
|
||||||
committed = true
|
committed = true
|
||||||
|
|
||||||
// 19. Post-commit: Rebuild FTS5 (cannot run inside transaction).
|
// 19. FTS5 rebuild skipped — contentless FTS5 (content='') cannot
|
||||||
if err := l.db.RebuildSearchIndex(); err != nil {
|
// delete individual rows, but stale entries are harmless: search
|
||||||
l.logger.Error("could not rebuild search index after removal", "err", err)
|
// queries JOIN against track_metadata which filters out deleted
|
||||||
}
|
// rows. The index is rebuilt on the next full rescan. Skipping
|
||||||
|
// avoids a costly full re-index of all remaining tracks (~10s for
|
||||||
|
// 25K tracks).
|
||||||
|
|
||||||
// 20. Post-commit: Delete orphaned cover art files.
|
// 20. Post-commit: Delete orphaned cover art files.
|
||||||
for _, coverPath := range orphanedCoverArtPaths {
|
for _, coverPath := range orphanedCoverArtPaths {
|
||||||
|
|||||||
Reference in New Issue
Block a user