lib/model: Refactor folder health/error handling (fixes #6557) (#6558)

This commit is contained in:
Simon Frei
2020-04-21 10:15:59 +02:00
committed by GitHub
parent c63ca4f563
commit 6bbd24de12
4 changed files with 22 additions and 32 deletions
+4 -8
View File
@@ -140,11 +140,6 @@ func newSendReceiveFolder(model *model, fset *db.FileSet, ignores *ignore.Matche
// pull returns true if it manages to get all needed items from peers, i.e. get
// the device in sync with the global state.
func (f *sendReceiveFolder) pull() bool {
if err := f.CheckHealth(); err != nil {
l.Debugln("Skipping pull of", f.Description(), "due to folder error:", err)
return false
}
// Check if the ignore patterns changed.
oldHash := f.ignores.Hash()
defer func() {
@@ -152,9 +147,10 @@ func (f *sendReceiveFolder) pull() bool {
f.ignoresUpdated()
}
}()
if err := f.ignores.Load(".stignore"); err != nil && !fs.IsNotExist(err) {
err = errors.Wrap(err, "loading ignores")
f.setError(err)
err := f.getHealthErrorAndLoadIgnores()
f.setError(err)
if err != nil {
l.Debugln("Skipping pull of", f.Description(), "due to folder error:", err)
return false
}