lib/model: Reset pull errors when succeeding (fix #5450) (#5451)

This commit is contained in:
Simon Frei 2019-01-14 08:30:52 +01:00 committed by Jakob Borg
parent 801e9b57eb
commit 51f65bd23a

View File

@ -187,29 +187,25 @@ func (f *sendReceiveFolder) pull() bool {
f.setState(FolderIdle)
}()
var changed int
tries := 0
for {
tries++
changed = f.pullerIteration(ignores, folderFiles, scanChan)
for tries := 0; tries < maxPullerIterations; tries++ {
select {
case <-f.ctx.Done():
return false
default:
}
l.Debugln(f, "changed", changed)
changed := f.pullerIteration(ignores, folderFiles, scanChan)
l.Debugln(f, "changed", changed, "on try", tries)
if changed == 0 {
// No files were changed by the puller, so we are in
// sync.
break
// sync. Any errors were just transitional.
f.clearPullErrors()
return true
}
}
if tries == maxPullerIterations {
// We've tried a bunch of times to get in sync, but
// we're not making it. Probably there are write
// errors preventing us. Flag this with a warning and
@ -220,11 +216,8 @@ func (f *sendReceiveFolder) pull() bool {
"errors": errors,
})
}
break
}
}
return changed == 0
return false
}
// pullerIteration runs a single puller iteration for the given folder and