mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-06 03:50:46 +00:00
Merge branch 'master' into marko/int64-
This commit is contained in:
@@ -118,12 +118,12 @@ func New(remote, wsEndpoint string) (*HTTP, error) {
|
||||
|
||||
// NewWithTimeout does the same thing as New, except you can set a Timeout for
|
||||
// http.Client. A Timeout of zero means no timeout.
|
||||
func NewWithTimeout(remote, wsEndpoint string, timeout uint) (*HTTP, error) {
|
||||
func NewWithTimeout(remote, wsEndpoint string, timeout time.Duration) (*HTTP, error) {
|
||||
httpClient, err := jsonrpcclient.DefaultHTTPClient(remote)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpClient.Timeout = time.Duration(timeout) * time.Second
|
||||
httpClient.Timeout = timeout
|
||||
return NewWithClient(remote, wsEndpoint, httpClient)
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ func getHTTPClient() *rpchttp.HTTP {
|
||||
return c
|
||||
}
|
||||
|
||||
func getHTTPClientWithTimeout(timeout uint) *rpchttp.HTTP {
|
||||
func getHTTPClientWithTimeout(timeout time.Duration) *rpchttp.HTTP {
|
||||
rpcAddr := rpctest.GetConfig().RPC.ListenAddress
|
||||
c, err := rpchttp.NewWithTimeout(rpcAddr, "/websocket", timeout)
|
||||
if err != nil {
|
||||
@@ -497,8 +497,7 @@ func TestTx(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTxSearchWithTimeout(t *testing.T) {
|
||||
// Get a client with a time-out of 10 secs.
|
||||
timeoutClient := getHTTPClientWithTimeout(10)
|
||||
timeoutClient := getHTTPClientWithTimeout(10 * time.Second)
|
||||
|
||||
_, _, tx := MakeTxKV()
|
||||
_, err := timeoutClient.BroadcastTxCommit(context.Background(), tx)
|
||||
|
||||
Reference in New Issue
Block a user