forked from TrueCloudLab/restic
rclone: Make concurrent connections configurable
This commit is contained in:
parent
0b776e63e7
commit
c43c94776b
3 changed files with 10 additions and 6 deletions
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -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,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue