Skip to content

Commit

Permalink
rpcclient: fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bhandras committed May 13, 2022
1 parent a86222c commit ebed192
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions rpcclient/infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,14 @@ func (c *Client) handleSendPostMessage(jReq *jsonRequest) {
}
url := protocol + "://" + c.config.Host

var err error
var backoff time.Duration
var httpResponse *http.Response
var (
err error
backoff time.Duration
httpResponse *http.Response
)

tries := 10
for i := 0; tries == 0 || i < tries; i++ {
for i := 0; i < tries; i++ {
bodyReader := bytes.NewReader(jReq.marshalledJSON)
httpReq, err := http.NewRequest("POST", url, bodyReader)
if err != nil {
Expand All @@ -799,7 +802,9 @@ func (c *Client) handleSendPostMessage(jReq *jsonRequest) {
if backoff > time.Minute {
backoff = time.Minute
}
log.Debugf("Failed command [%s] with id %d attempt %d. Retrying in %v... \n", jReq.method, jReq.id, i, backoff)
log.Debugf("Failed command [%s] with id %d attempt %d."+
" Retrying in %v... \n", jReq.method, jReq.id,
i, backoff)
time.Sleep(backoff)
continue
}
Expand Down

0 comments on commit ebed192

Please sign in to comment.