Skip to content

Commit

Permalink
feature: MaxIdleConns is now configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
asoorm committed May 11, 2018
1 parent 1c01ddc commit 593e29f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ type Config struct {
EnableBundleDownloader bool `bson:"enable_bundle_downloader" json:"enable_bundle_downloader"`
AllowRemoteConfig bool `bson:"allow_remote_config" json:"allow_remote_config"`
LegacyEnableAllowanceCountdown bool `bson:"legacy_enable_allowance_countdown" json:"legacy_enable_allowance_countdown"`
MaxIdleConns int `bson:"max_idle_connections" json:"max_idle_connections"`
MaxIdleConnsPerHost int `bson:"max_idle_connections_per_host" json:"max_idle_connections_per_host"`
MaxConnTime int64 `json:"max_conn_time"`
ReloadWaitTime int `bson:"reload_wait_time" json:"reload_wait_time"`
Expand Down
3 changes: 3 additions & 0 deletions lint/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ const confSchema = `{
"max_idle_connections_per_host": {
"type": "integer"
},
"max_idle_connections": {
"type": "integer"
},
"max_conn_time": {
"type": "integer"
},
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -884,9 +884,11 @@ func afterConfSetup(conf *config.Config) {
if conf.SlaveOptions.CallTimeout == 0 {
conf.SlaveOptions.CallTimeout = 30
}

if conf.SlaveOptions.PingTimeout == 0 {
conf.SlaveOptions.PingTimeout = 60
}

GlobalRPCPingTimeout = time.Second * time.Duration(conf.SlaveOptions.PingTimeout)
GlobalRPCCallTimeout = time.Second * time.Duration(conf.SlaveOptions.CallTimeout)
conf.EventTriggers = InitGenericEventHandlers(conf.EventHandlers)
Expand Down
2 changes: 1 addition & 1 deletion reverse_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func defaultTransport() *http.Transport {
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext,
MaxIdleConns: 100,
MaxIdleConns: config.Global().MaxIdleConns,
MaxIdleConnsPerHost: config.Global().MaxIdleConnsPerHost, // default is 100
TLSHandshakeTimeout: 10 * time.Second,
}
Expand Down

0 comments on commit 593e29f

Please sign in to comment.