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{ restConfig := rest.Config{
Connections: 20, Connections: cfg.Connections,
URL: url, URL: url,
} }

View file

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