2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 02:48:55 +00:00

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

@ -0,0 +1,7 @@
Enhancement: Support timeout configurable for rclone backend
A slow rclone backend could cause restic to time out while waiting for the repository to open.
Restic now offers an `-o rclone.timeout` option to make this timeout configurable.
https://github.com/restic/restic/issues/3511
https://github.com/restic/restic/pull/3514

View File

@ -607,10 +607,11 @@ configuring a bandwidth limit for rclone can be achieved by setting the
For debugging rclone, you can set the environment variable ``RCLONE_VERBOSE=2``.
The rclone backend has two additional options:
The rclone backend has three additional options:
* ``-o rclone.program`` specifies the path to rclone, the default value is just ``rclone``
* ``-o rclone.args`` allows setting the arguments passed to rclone, by default this is ``serve restic --stdio --b2-hard-delete``
* ``-o rclone.timeout`` specifies timeout for waiting on repository opening, the default value is ``1m``
The reason for the ``--b2-hard-delete`` parameters can be found in the corresponding GitHub `issue #1657`_.

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,
},
},
}