Skip to content

Commit

Permalink
rpcclient: add http timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
ziggie1984 committed Oct 10, 2024
1 parent 67b8efd commit 44c874f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rpcclient/infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ const (
// requestRetryInterval is the initial amount of time to wait in between
// retries when sending HTTP POST requests.
requestRetryInterval = time.Millisecond * 500

// defaultHTTPTimeout is the default timeout for an http request, so the
// request does not block indefinitely.
defaultHTTPTimeout = time.Minute
)

// jsonRequest holds information about a json request that is used to properly
Expand Down Expand Up @@ -1363,6 +1367,7 @@ func newHTTPClient(config *ConnConfig) (*http.Client, error) {
return net.Dial(parsedAddr.Network(), parsedAddr.String())
},
},
Timeout: defaultHTTPTimeout,
}

return &client, nil
Expand Down

0 comments on commit 44c874f

Please sign in to comment.