mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
Merge pull request #1882 from calmh/folderstats
Reduce db writes for small files
This commit is contained in:
commit
ceced09d02
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user