Skip to content

Commit

Permalink
Merge pull request #139 from mysteriumnetwork/configure-timeout
Browse files Browse the repository at this point in the history
Allow to configure timeouts
  • Loading branch information
tomasmik authored Oct 4, 2021
2 parents 0d7c424 + 334f0c7 commit 439f093
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions transfer/gas/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type EthStation struct {
}

// NewEthStation returns a new instance of defi pulse api for gas price checks.
func NewEthStation(apiKey, endpointURI string, upperBound *big.Int) *EthStation {
func NewEthStation(timeout time.Duration, apiKey, endpointURI string, upperBound *big.Int) *EthStation {
endpoint := endpointURI
if !strings.HasSuffix(endpoint, "/") {
endpoint += "/"
Expand All @@ -44,7 +44,7 @@ func NewEthStation(apiKey, endpointURI string, upperBound *big.Int) *EthStation
ExpectContinueTimeout: 4 * time.Second,
ResponseHeaderTimeout: 3 * time.Second,
},
Timeout: 10 * time.Second,
Timeout: timeout,
},
APIKey: apiKey,
EndpointURI: endpoint,
Expand Down
4 changes: 2 additions & 2 deletions transfer/gas/etherscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ type EtherscanStation struct {
}

// NewEtherscanStation returns a new instance of etherscan api for gas price checks.
func NewEtherscanStation(apiKey, endpointURI string, upperBound *big.Int) *EtherscanStation {
func NewEtherscanStation(timeout time.Duration, apiKey, endpointURI string, upperBound *big.Int) *EtherscanStation {
endpoint := endpointURI
if !strings.HasSuffix(endpoint, "/") {
endpoint += "/"
}

return &EtherscanStation{
client: &http.Client{
Timeout: 10 * time.Second,
Timeout: timeout,
},
endpointURI: endpointURI,
upperBound: upperBound,
Expand Down

0 comments on commit 439f093

Please sign in to comment.