Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address: API calls cancelled by client because of Timeout #926

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pagerduty/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ func (c *Config) Client() (*pagerduty.Client, error) {
httpClient.Timeout = 2 * time.Minute

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 @@ -142,8 +150,17 @@ func (c *Config) SlackClient() (*pagerduty.Client, error) {

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

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
8 changes: 8 additions & 0 deletions pagerdutyplugin/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ func (c *Config) Client(ctx context.Context) (*pagerduty.Client, error) {
httpClient.Timeout = 2 * time.Minute

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
Loading