Reschedule the next scan interval (fixes #1591)

This commit is contained in:
Lode Hoste
2015-05-01 14:30:17 +02:00
parent 33048f88b8
commit fe34b08ece
7 changed files with 178 additions and 19 deletions

View File

@@ -20,6 +20,7 @@ import (
"net/http"
"os"
"os/exec"
"strconv"
"time"
"github.com/syncthing/protocol"
@@ -322,6 +323,19 @@ func (p *syncthingProcess) rescan(folder string) error {
return nil
}
func (p *syncthingProcess) rescanNext(folder string, next time.Duration) error {
resp, err := p.post("/rest/db/scan?folder="+folder+"&next="+strconv.Itoa(int(next.Seconds())), nil)
if err != nil {
return err
}
data, _ := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if resp.StatusCode != 200 {
return fmt.Errorf("Rescan %q: status code %d: %s", folder, resp.StatusCode, data)
}
return nil
}
func (p *syncthingProcess) reset(folder string) error {
resp, err := p.post("/rest/system/reset?folder="+folder, nil)
if err != nil {