rclone: add timeout option and documentation

This commit is contained in:
phcreery
2021-09-15 19:27:47 -05:00
committed by Michael Eischer
parent 6c84ea1412
commit 43d173b042
5 changed files with 15 additions and 3 deletions

View File

@@ -222,7 +222,7 @@ func newBackend(cfg Config, lim limiter.Limiter) (*Backend, error) {
// send an HTTP request to the base URL, see if the server is there
client := &http.Client{
Transport: debug.RoundTripper(tr),
Timeout: 60 * time.Second,
Timeout: cfg.Timeout * 60 * time.Second,
}
// request a random file which does not exist. we just want to test when

View File

@@ -2,6 +2,7 @@ package rclone
import (
"strings"
"time"
"github.com/restic/restic/internal/errors"
"github.com/restic/restic/internal/options"
@@ -12,13 +13,15 @@ type Config struct {
Program string `option:"program" help:"path to rclone (default: rclone)"`
Args string `option:"args" help:"arguments for running rclone (default: serve restic --stdio --b2-hard-delete)"`
Remote string
Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 5)"`
Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 5)"`
Timeout time.Duration `option:"timeout" help:"set a timeout limit to wait for rclone to establish a connection (default: 1m)"`
}
var defaultConfig = Config{
Program: "rclone",
Args: "serve restic --stdio --b2-hard-delete",
Connections: 5,
Timeout: "1m",
}
func init() {

View File

@@ -17,6 +17,7 @@ func TestParseConfig(t *testing.T) {
Program: defaultConfig.Program,
Args: defaultConfig.Args,
Connections: defaultConfig.Connections,
Timeout: defaultConfig.Timeout,
},
},
}