lib/model: Don't force rescan already changed items (#6798)
This commit is contained in:
parent
90e248615f
commit
0648fb0626
|
@ -953,9 +953,13 @@ func (f *folder) updateLocals(fs []protocol.FileInfo) {
|
||||||
f.fset.Update(protocol.LocalDeviceID, fs)
|
f.fset.Update(protocol.LocalDeviceID, fs)
|
||||||
|
|
||||||
filenames := make([]string, len(fs))
|
filenames := make([]string, len(fs))
|
||||||
|
f.forcedRescanPathsMut.Lock()
|
||||||
for i, file := range fs {
|
for i, file := range fs {
|
||||||
filenames[i] = file.Name
|
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{}{
|
f.evLogger.Log(events.LocalIndexUpdated, map[string]interface{}{
|
||||||
"folder": f.ID,
|
"folder": f.ID,
|
||||||
|
@ -1005,6 +1009,9 @@ func (f *folder) handleForcedRescans() {
|
||||||
}
|
}
|
||||||
f.forcedRescanPaths = make(map[string]struct{})
|
f.forcedRescanPaths = make(map[string]struct{})
|
||||||
f.forcedRescanPathsMut.Unlock()
|
f.forcedRescanPathsMut.Unlock()
|
||||||
|
if len(paths) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
batch := newFileInfoBatch(func(fs []protocol.FileInfo) error {
|
batch := newFileInfoBatch(func(fs []protocol.FileInfo) error {
|
||||||
f.fset.Update(protocol.LocalDeviceID, fs)
|
f.fset.Update(protocol.LocalDeviceID, fs)
|
||||||
|
|
Loading…
Reference in New Issue