lib/model: Don't force rescan already changed items (#6798)

This commit is contained in:
Simon Frei 2020-06-25 20:23:59 +02:00 committed by GitHub
parent 90e248615f
commit 0648fb0626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -953,9 +953,13 @@ func (f *folder) updateLocals(fs []protocol.FileInfo) {
f.fset.Update(protocol.LocalDeviceID, fs)
filenames := make([]string, len(fs))
f.forcedRescanPathsMut.Lock()
for i, file := range fs {
filenames[i] = file.Name
// No need to rescan a file that was changed since anyway.
delete(f.forcedRescanPaths, file.Name)
}
f.forcedRescanPathsMut.Unlock()
f.evLogger.Log(events.LocalIndexUpdated, map[string]interface{}{
"folder": f.ID,
@ -1005,6 +1009,9 @@ func (f *folder) handleForcedRescans() {
}
f.forcedRescanPaths = make(map[string]struct{})
f.forcedRescanPathsMut.Unlock()
if len(paths) == 0 {
return
}
batch := newFileInfoBatch(func(fs []protocol.FileInfo) error {
f.fset.Update(protocol.LocalDeviceID, fs)