From 6cf01c1d30ad4d74ca4ecb3ccf34716cca9b93db Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Fri, 17 Nov 2017 12:42:41 +0000 Subject: [PATCH] lib/model: Don't update ignore hash when pull fails GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4522 --- lib/model/rwfolder.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/model/rwfolder.go b/lib/model/rwfolder.go index 69c0a6a4e..44dd5e067 100644 --- a/lib/model/rwfolder.go +++ b/lib/model/rwfolder.go @@ -239,6 +239,11 @@ func (f *sendReceiveFolder) pull(prevIgnoreHash string) (curIgnoreHash string, s return prevIgnoreHash, true } + if err := f.CheckHealth(); err != nil { + l.Debugln("Skipping pull of", f.Description(), "due to folder error:", err) + return prevIgnoreHash, true + } + f.model.fmut.RLock() curIgnores := f.model.folderIgnores[f.folderID] f.model.fmut.RUnlock() @@ -246,11 +251,6 @@ func (f *sendReceiveFolder) pull(prevIgnoreHash string) (curIgnoreHash string, s curIgnoreHash = curIgnores.Hash() ignoresChanged := curIgnoreHash != prevIgnoreHash - if err := f.CheckHealth(); err != nil { - l.Debugln("Skipping pull of", f.Description(), "due to folder error:", err) - return curIgnoreHash, true - } - l.Debugln(f, "pulling") f.setState(FolderSyncing) @@ -294,7 +294,11 @@ func (f *sendReceiveFolder) pull(prevIgnoreHash string) (curIgnoreHash string, s f.setState(FolderIdle) - return curIgnoreHash, changed == 0 + if changed == 0 { + return curIgnoreHash, true + } + + return prevIgnoreHash, false } // pullerIteration runs a single puller iteration for the given folder and