Skip to content

Commit

Permalink
Wait in coinstellix if request was rate limited
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnjack committed Nov 30, 2023
1 parent 7186ebb commit 460715e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion providers/dns/constellix/internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ func (c *Client) do(req *http.Request, result any) error {
return errutils.NewHTTPDoError(req, err)
}

defer func() { _ = resp.Body.Close() }()
defer resp.Body.Close()

if resp.StatusCode == 429 {
fmt.Println("Rate limit exceeded, waiting 5 seconds...")
time.Sleep(5 * time.Second)
return c.do(req, result)
}

err = checkResponse(resp)
if err != nil {
Expand Down

0 comments on commit 460715e

Please sign in to comment.