lib/model: Do Revert/Override synchronously (#6460)

This commit is contained in:
Simon Frei
2020-03-27 13:05:09 +01:00
committed by GitHub
parent c7cf3ef899
commit 79a758be3c
3 changed files with 30 additions and 13 deletions
+6 -1
View File
@@ -97,9 +97,15 @@ func (f *sendOnlyFolder) pull() bool {
}
func (f *sendOnlyFolder) Override() {
f.doInSync(func() error { f.override(); return nil })
}
func (f *sendOnlyFolder) override() {
l.Infof("Overriding global state on folder %v", f.Description)
f.setState(FolderScanning)
defer f.setState(FolderIdle)
batch := make([]protocol.FileInfo, 0, maxBatchSizeFiles)
batchSizeBytes := 0
snap := f.fset.Snapshot()
@@ -134,5 +140,4 @@ func (f *sendOnlyFolder) Override() {
if len(batch) > 0 {
f.updateLocalsFromScanning(batch)
}
f.setState(FolderIdle)
}