Don't needlessly refresh the live cache

This commit is contained in:
Simon Cambier
2024-06-07 12:30:00 +02:00
parent 0d6ed3eb61
commit 2f6e25ce47
2 changed files with 15 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import {
isFileFromDataloomPlugin,
isFileImage,
isFilePDF,
logDebug,
} from './tools/utils'
export class NotesIndexer {
@@ -23,6 +24,11 @@ export class NotesIndexer {
}
public async refreshIndex(): Promise<void> {
for (const file of this.notesToReindex) {
logDebug('Updating file', file.path)
await this.plugin.cacheManager.addToLiveCache(file.path)
}
const paths = [...this.notesToReindex].map(n => n.path)
if (paths.length) {
this.plugin.searchEngine.removeFromPaths(paths)