model: Use separate db commit routine (fixes #1558)

This commit is contained in:
Jakob Borg
2015-04-05 15:34:29 +02:00
parent 515f0db5b4
commit ecadf30fe7
3 changed files with 78 additions and 26 deletions

View File

@@ -1027,17 +1027,14 @@ func sendIndexTo(initial bool, minLocalVer int64, conn protocol.Connection, fold
return maxLocalVer, err
}
func (m *Model) updateLocal(folder string, f protocol.FileInfo) {
f.LocalVersion = 0
func (m *Model) updateLocals(folder string, fs []protocol.FileInfo) {
m.fmut.RLock()
m.folderFiles[folder].Update(protocol.LocalDeviceID, []protocol.FileInfo{f})
m.folderFiles[folder].Update(protocol.LocalDeviceID, fs)
m.fmut.RUnlock()
events.Default.Log(events.LocalIndexUpdated, map[string]interface{}{
"folder": folder,
"name": f.Name,
"modified": time.Unix(f.Modified, 0),
"flags": fmt.Sprintf("0%o", f.Flags),
"size": f.Size(),
"numFiles": len(fs),
})
}