Skip to content

Commit

Permalink
Using ClientWithTimeout instead Client
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Mar 2, 2023
1 parent 7057b7a commit a11a8df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions lite/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
func (c *Client) queryAccount(remote string, accAddr sdk.AccAddress) (authtypes.AccountI, error) {
c.log.Debug("Querying the account", "remote", remote, "address", accAddr)

client, err := rpchttp.New(remote, "/websocket")
client, err := rpchttp.NewWithTimeout(remote, "/websocket", 5)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -65,7 +65,7 @@ func (c *Client) QueryAccount(accAddr sdk.AccAddress) (result authtypes.AccountI
func (c *Client) queryNode(remote string, nodeAddr hubtypes.NodeAddress) (*nodetypes.Node, error) {
c.log.Debug("Querying the node", "remote", remote, "address", nodeAddr)

client, err := rpchttp.New(remote, "/websocket")
client, err := rpchttp.NewWithTimeout(remote, "/websocket", 5)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -104,7 +104,7 @@ func (c *Client) QueryNode(nodeAddr hubtypes.NodeAddress) (result *nodetypes.Nod
func (c *Client) querySubscription(remote string, id uint64) (*subscriptiontypes.Subscription, error) {
c.log.Debug("Querying the subscription", "remote", remote, "id", id)

client, err := rpchttp.New(remote, "/websocket")
client, err := rpchttp.NewWithTimeout(remote, "/websocket", 5)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -143,7 +143,7 @@ func (c *Client) QuerySubscription(id uint64) (result *subscriptiontypes.Subscri
func (c *Client) queryQuota(remote string, id uint64, accAddr sdk.AccAddress) (*subscriptiontypes.Quota, error) {
c.log.Debug("Querying the quota", "remote", remote, "id", id, "address", accAddr)

client, err := rpchttp.New(remote, "/websocket")
client, err := rpchttp.NewWithTimeout(remote, "/websocket", 5)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -182,7 +182,7 @@ func (c *Client) QueryQuota(id uint64, accAddr sdk.AccAddress) (result *subscrip
func (c *Client) querySession(remote string, id uint64) (*sessiontypes.Session, error) {
c.log.Debug("Querying the session", "id", id)

client, err := rpchttp.New(remote, "/websocket")
client, err := rpchttp.NewWithTimeout(remote, "/websocket", 5)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -219,7 +219,7 @@ func (c *Client) QuerySession(id uint64) (result *sessiontypes.Session, err erro
}

func (c *Client) hasNodeForPlan(remote string, id uint64, nodeAddr hubtypes.NodeAddress) (bool, error) {
client, err := rpchttp.New(remote, "/websocket")
client, err := rpchttp.NewWithTimeout(remote, "/websocket", 5)
if err != nil {
return false, err
}
Expand Down
4 changes: 2 additions & 2 deletions lite/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func (c *Client) broadcastTx(remote string, txBytes []byte) (*sdk.TxResponse, error) {
c.log.Debug("Broadcasting the transaction", "remote", remote, "size", len(txBytes))

client, err := rpchttp.New(remote, "/websocket")
client, err := rpchttp.NewWithTimeout(remote, "/websocket", 5)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -58,7 +58,7 @@ func (c *Client) BroadcastTx(txBytes []byte) (res *sdk.TxResponse, err error) {
func (c *Client) calculateGas(remote string, txf tx.Factory, messages ...sdk.Msg) (uint64, error) {
c.log.Debug("Calculating the gas", "remote", remote, "messages", len(messages))

client, err := rpchttp.New(remote, "/websocket")
client, err := rpchttp.NewWithTimeout(remote, "/websocket", 5)
if err != nil {
return 0, err
}
Expand Down

0 comments on commit a11a8df

Please sign in to comment.