Skip to content

Commit

Permalink
update http client timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
imjaroiswebdev committed Aug 22, 2024
1 parent 60e9dd0 commit e0522f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
20 changes: 2 additions & 18 deletions pagerduty/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,9 @@ func (c *Config) Client() (*pagerduty.Client, error) {

var httpClient *http.Client
httpClient = http.DefaultClient
httpClient.Timeout = 2 * time.Minute
httpClient.Timeout = 30 * time.Second

transport := http.DefaultTransport.(*http.Transport).Clone()
// Set the maximum number of idle (keep-alive) connections across all hosts
// Experimenting with these values to see if it helps with the connection pool
// and hence to solve the issue
// https://github.com/PagerDuty/terraform-provider-pagerduty/issues/904
transport.MaxIdleConns = 0
transport.MaxIdleConnsPerHost = 500
transport.MaxConnsPerHost = 0

if c.InsecureTls {
transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
Expand Down Expand Up @@ -150,17 +142,9 @@ func (c *Config) SlackClient() (*pagerduty.Client, error) {

var httpClient *http.Client
httpClient = http.DefaultClient
httpClient.Timeout = 2 * time.Minute
httpClient.Timeout = 30 * time.Second

transport := http.DefaultTransport.(*http.Transport).Clone()
// Set the maximum number of idle (keep-alive) connections across all hosts
// Experimenting with these values to see if it helps with the connection pool
// and hence to solve the issue
// https://github.com/PagerDuty/terraform-provider-pagerduty/issues/904
transport.MaxIdleConns = 0
transport.MaxIdleConnsPerHost = 500
transport.MaxConnsPerHost = 0

if c.InsecureTls {
transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
Expand Down
10 changes: 1 addition & 9 deletions pagerdutyplugin/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,9 @@ func (c *Config) Client(ctx context.Context) (*pagerduty.Client, error) {
}

httpClient := http.DefaultClient
httpClient.Timeout = 2 * time.Minute
httpClient.Timeout = 30 * time.Second

transport := http.DefaultTransport.(*http.Transport).Clone()
// Set the maximum number of idle (keep-alive) connections across all hosts
// Experimenting with these values to see if it helps with the connection pool
// and hence to solve the issue
// https://github.com/PagerDuty/terraform-provider-pagerduty/issues/904
transport.MaxIdleConns = 0
transport.MaxIdleConnsPerHost = 500
transport.MaxConnsPerHost = 0

if c.InsecureTls {
transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
Expand Down

0 comments on commit e0522f5

Please sign in to comment.