swift/rest: Reduce number of connections

This commit is contained in:
Alexander Neumann 2017-06-11 13:46:54 +02:00
parent a89a7a783a
commit 58de8bf392
5 changed files with 11 additions and 11 deletions

View File

@ -211,7 +211,7 @@ var parseTests = []struct {
Config: swift.Config{ Config: swift.Config{
Container: "container17", Container: "container17",
Prefix: "", Prefix: "",
Connections: 20, Connections: 5,
}, },
}, },
}, },
@ -221,7 +221,7 @@ var parseTests = []struct {
Config: swift.Config{ Config: swift.Config{
Container: "container17", Container: "container17",
Prefix: "prefix97", Prefix: "prefix97",
Connections: 20, Connections: 5,
}, },
}, },
}, },
@ -230,7 +230,7 @@ var parseTests = []struct {
Location{Scheme: "rest", Location{Scheme: "rest",
Config: rest.Config{ Config: rest.Config{
URL: parseURL("http://hostname.foo:1234/"), URL: parseURL("http://hostname.foo:1234/"),
Connections: 20, Connections: 5,
}, },
}, },
}, },

View File

@ -11,7 +11,7 @@ import (
// Config contains all configuration necessary to connect to a REST server. // Config contains all configuration necessary to connect to a REST server.
type Config struct { type Config struct {
URL *url.URL URL *url.URL
Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 20)"` Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 5)"`
} }
func init() { func init() {
@ -21,7 +21,7 @@ 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: 20, Connections: 5,
} }
} }

View File

@ -21,7 +21,7 @@ var configTests = []struct {
}{ }{
{"rest:http://localhost:1234", Config{ {"rest:http://localhost:1234", Config{
URL: parseURL("http://localhost:1234"), URL: parseURL("http://localhost:1234"),
Connections: 20, Connections: 5,
}}, }},
} }

View File

@ -26,7 +26,7 @@ type Config struct {
Prefix string Prefix string
DefaultContainerPolicy string DefaultContainerPolicy string
Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 20)"` Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 5)"`
} }
func init() { func init() {
@ -36,7 +36,7 @@ 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: 20, Connections: 5,
} }
} }

View File

@ -11,21 +11,21 @@ var configTests = []struct {
Config{ Config{
Container: "cnt1", Container: "cnt1",
Prefix: "", Prefix: "",
Connections: 20, Connections: 5,
}, },
}, },
{ {
"swift:cnt2:/prefix", "swift:cnt2:/prefix",
Config{Container: "cnt2", Config{Container: "cnt2",
Prefix: "prefix", Prefix: "prefix",
Connections: 20, Connections: 5,
}, },
}, },
{ {
"swift:cnt3:/prefix/longer", "swift:cnt3:/prefix/longer",
Config{Container: "cnt3", Config{Container: "cnt3",
Prefix: "prefix/longer", Prefix: "prefix/longer",
Connections: 20, Connections: 5,
}, },
}, },
} }