mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-03 07:12:27 +00:00
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:
parent
2590536ef3
commit
237893ead3
@ -1140,18 +1140,17 @@ func (s *apiService) postDBScan(w http.ResponseWriter, r *http.Request) {
|
|||||||
qs := r.URL.Query()
|
qs := r.URL.Query()
|
||||||
folder := qs.Get("folder")
|
folder := qs.Get("folder")
|
||||||
if 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")
|
nextStr := qs.Get("next")
|
||||||
next, err := strconv.Atoi(nextStr)
|
next, err := strconv.Atoi(nextStr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
s.model.DelayScan(folder, time.Duration(next)*time.Second)
|
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 {
|
} else {
|
||||||
errors := s.model.ScanFolders()
|
errors := s.model.ScanFolders()
|
||||||
if len(errors) > 0 {
|
if len(errors) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user