rclone: Make concurrent connections configurable

This commit is contained in:
Alexander Neumann 2018-03-24 18:37:36 +01:00
parent 0b776e63e7
commit c43c94776b
3 changed files with 10 additions and 6 deletions

View File

@ -212,7 +212,7 @@ func Open(cfg Config) (*Backend, error) {
}
restConfig := rest.Config{
Connections: 20,
Connections: cfg.Connections,
URL: url,
}

View File

@ -9,9 +9,10 @@ import (
// Config contains all configuration necessary to start rclone.
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)"`
Remote string
Program string `option:"program" help:"path to rclone (default: rclone)"`
Args string `option:"args" help:"arguments for running rclone (default: serve restic --stdio)"`
Remote string
Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 5)"`
}
func init() {
@ -20,7 +21,9 @@ func init() {
// NewConfig returns a new Config with the default values filled in.
func NewConfig() Config {
return Config{}
return Config{
Connections: 5,
}
}
// ParseConfig parses the string s and extracts the remote server URL.

View File

@ -13,7 +13,8 @@ func TestParseConfig(t *testing.T) {
{
"rclone:local:foo:/bar",
Config{
Remote: "local:foo:/bar",
Remote: "local:foo:/bar",
Connections: 5,
},
},
}