Reschedule the next scan interval (fixes #1591)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user