Skip to content

Commit

Permalink
Merge pull request #928 from imjaroiswebdev/issue-904-repatch
Browse files Browse the repository at this point in the history
Second attempt to address: API calls cancelled by client because of Timeout
  • Loading branch information
imjaroiswebdev authored Aug 23, 2024
2 parents 60e9dd0 + e0522f5 commit 44667a7
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 44667a7

Please sign in to comment.