forked from berachain/offchain-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(rpc): Add timeouts to all network calls (berachain#71)
* rpc timeout * lint
- Loading branch information
Showing
7 changed files
with
141 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
package eth | ||
|
||
// Config is the configuration for the eth client. | ||
type Config struct { | ||
EthHTTPURLs string | ||
EthWSURLs string | ||
import "time" | ||
|
||
const ( | ||
defaultRPCTimeout = 5 * time.Second | ||
defaultHealthCheckInterval = 5 * time.Second | ||
) | ||
|
||
type ConnectionPoolConfig struct { | ||
EthHTTPURLs []string | ||
EthWSURLs []string | ||
DefaultTimeout time.Duration | ||
HealthCheckInterval time.Duration | ||
} | ||
|
||
func DefaultConfig() *Config { | ||
return &Config{ | ||
EthHTTPURLs: "http://localhost:8545", | ||
EthWSURLs: "ws://localhost:8546", | ||
func DefaultConnectPoolConfig() *ConnectionPoolConfig { | ||
return &ConnectionPoolConfig{ | ||
EthHTTPURLs: []string{"http://localhost:8545"}, | ||
EthWSURLs: []string{"ws://localhost:8546"}, | ||
DefaultTimeout: defaultRPCTimeout, | ||
HealthCheckInterval: defaultHealthCheckInterval, | ||
} | ||
} |
Oops, something went wrong.