cmd/syncthing: Only delay next scan (via REST) if the scan succeeds

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3927
This commit is contained in:
Simon Frei 2017-02-05 18:17:44 +00:00 committed by Jakob Borg
parent 2590536ef3
commit 237893ead3
1 changed files with 6 additions and 7 deletions

View File

@ -1140,18 +1140,17 @@ func (s *apiService) postDBScan(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
folder := qs.Get("folder")
if folder != "" {
subs := qs["sub"]
err := s.model.ScanFolderSubdirs(folder, subs)
if err != nil {
http.Error(w, err.Error(), 500)
return
}
nextStr := qs.Get("next")
next, err := strconv.Atoi(nextStr)
if err == nil {
s.model.DelayScan(folder, time.Duration(next)*time.Second)
}
subs := qs["sub"]
err = s.model.ScanFolderSubdirs(folder, subs)
if err != nil {
http.Error(w, err.Error(), 500)
return
}
} else {
errors := s.model.ScanFolders()
if len(errors) > 0 {