Skip to content

Commit 6008e7c

Browse files
committed
Added reset function too
1 parent f957be7 commit 6008e7c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

httpclient/client.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"go.uber.org/zap"
1818
)
1919

20-
const DefaultTimeout time.Duration = 5 * time.Second
20+
const DefaultTimeout time.Duration = 10 * time.Second
2121

2222
// Master struct/object
2323
type Client struct {
@@ -135,8 +135,6 @@ func (c *ClientConfig) Build() (*Client, error) {
135135
)
136136
}
137137

138-
139-
140138
client := &Client{
141139
Integration: &c.Integration,
142140
http: &httpClient,

httpclient/timeouts.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@ import (
77

88
var mu sync.Mutex
99

10-
// Modifies the HTTP timeout time
10+
// Amends the HTTP timeout time
1111
func (c *Client) ModifyHttpTimeout(newTimeout time.Duration) {
1212
mu.Lock()
1313
defer mu.Unlock()
1414
c.http.Timeout = newTimeout
1515
}
16+
17+
// Resets HTTP timeout time back to 10 seconds
18+
func (c *Client) ResetTimeout() {
19+
mu.Lock()
20+
defer mu.Unlock()
21+
c.http.Timeout = DefaultTimeout
22+
}

0 commit comments

Comments
 (0)