Merge pull request #1882 from calmh/folderstats

Reduce db writes for small files
This commit is contained in:
Jakob Borg 2015-05-27 22:02:04 +02:00
commit ceced09d02
1 changed files with 3 additions and 1 deletions

View File

@ -1182,7 +1182,6 @@ func (p *rwFolder) finisherRoutine(in <-chan *sharedPullerState) {
"action": "update", "action": "update",
}) })
} }
p.model.receivedFile(p.folder, state.file.Name)
if p.progressEmitter != nil { if p.progressEmitter != nil {
p.progressEmitter.Deregister(state) p.progressEmitter.Deregister(state)
} }
@ -1228,12 +1227,14 @@ loop:
if len(batch) == maxBatchSize { if len(batch) == maxBatchSize {
p.model.updateLocals(p.folder, batch) p.model.updateLocals(p.folder, batch)
p.model.receivedFile(p.folder, batch[len(batch)-1].Name)
batch = batch[:0] batch = batch[:0]
} }
case <-tick.C: case <-tick.C:
if len(batch) > 0 { if len(batch) > 0 {
p.model.updateLocals(p.folder, batch) p.model.updateLocals(p.folder, batch)
p.model.receivedFile(p.folder, batch[len(batch)-1].Name)
batch = batch[:0] batch = batch[:0]
} }
} }
@ -1241,6 +1242,7 @@ loop:
if len(batch) > 0 { if len(batch) > 0 {
p.model.updateLocals(p.folder, batch) p.model.updateLocals(p.folder, batch)
p.model.receivedFile(p.folder, batch[len(batch)-1].Name)
} }
} }