Skip to content

Commit

Permalink
[Fix #182] Test success before retrying request
Browse files Browse the repository at this point in the history
Signed-off-by: Russell Troxel <russelltroxel@gmail.com>
  • Loading branch information
rtrox committed Dec 29, 2022
1 parent caeae58 commit 4427c21
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion spotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ func (c *Client) execute(req *http.Request, result interface{}, needsStatus ...i
}
defer resp.Body.Close()

if c.autoRetry && shouldRetry(resp.StatusCode) {
if c.autoRetry &&
isFailure(resp.StatusCode, needsStatus) &&
shouldRetry(resp.StatusCode) {
time.Sleep(retryDuration(resp))
continue
}
Expand Down

0 comments on commit 4427c21

Please sign in to comment.