mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 02:48:55 +00:00
Merge pull request #3514 from phcreery/rclone_timeout
rclone: extend timeout from 60s to 240s
This commit is contained in:
commit
f1cfb97237
7
changelog/unreleased/pull-3514
Normal file
7
changelog/unreleased/pull-3514
Normal 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
|
@ -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`_.
|
||||
|
||||
|
@ -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,
|
||||
}
|
||||
|
||||
// request a random file which does not exist. we just want to test when
|
||||
|
@ -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: time.Minute,
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@ -17,6 +17,7 @@ func TestParseConfig(t *testing.T) {
|
||||
Program: defaultConfig.Program,
|
||||
Args: defaultConfig.Args,
|
||||
Connections: defaultConfig.Connections,
|
||||
Timeout: defaultConfig.Timeout,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user