Skip to content

Commit 58eeb0a

Browse files
committed
[dev] add a 30-second timeout for client
1 parent 3c8032c commit 58eeb0a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

client.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"net/http"
1616
"net/http/httputil"
1717
"net/url"
18+
"time"
1819
)
1920

2021
// Client etherscan API client
@@ -41,7 +42,9 @@ type Client struct {
4142
// please use pre-defined network value
4243
func New(network Network, APIKey string) *Client {
4344
return &Client{
44-
coon: &http.Client{},
45+
coon: &http.Client{
46+
Timeout: 30 * time.Second,
47+
},
4548
network: network,
4649
key: APIKey,
4750
baseURL: fmt.Sprintf(`https://%s.etherscan.io/api?`, network.SubDomain()),

0 commit comments

Comments
 (0)