Skip to content
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
4 changes: 1 addition & 3 deletions httpclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"go.uber.org/zap"
)

const DefaultTimeout time.Duration = 5 * time.Second
const DefaultTimeout time.Duration = 10 * time.Second

// Master struct/object
type Client struct {
Expand Down Expand Up @@ -135,8 +135,6 @@ func (c *ClientConfig) Build() (*Client, error) {
)
}



client := &Client{
Integration: &c.Integration,
http: &httpClient,
Expand Down
22 changes: 22 additions & 0 deletions httpclient/timeouts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package httpclient

import (
"sync"
"time"
)

var mu sync.Mutex

// Amends the HTTP timeout time
func (c *Client) ModifyHttpTimeout(newTimeout time.Duration) {
mu.Lock()
defer mu.Unlock()
c.http.Timeout = newTimeout
}

// Resets HTTP timeout time back to 10 seconds
func (c *Client) ResetTimeout() {
mu.Lock()
defer mu.Unlock()
c.http.Timeout = DefaultTimeout
}
Loading