spotify icon indicating copy to clipboard operation
spotify copied to clipboard

Remove 202 from shouldRetry

Open Wakeful-Cloud opened this issue 4 years ago • 3 comments

Fixes #182

NOTE: I don't know if http.StatusAccepted is used by other endpoints in cases where the response needs to be retried.

Wakeful-Cloud avatar Jan 06 '22 04:01 Wakeful-Cloud

Thanks for raising this. I'll take a look tonight along with the other open PR.

strideynet avatar Jan 06 '22 10:01 strideynet

I'm a little worried this might break some existing retries that are valid, So I'm going to need to take a bit of a deeper look.

strideynet avatar Jan 07 '22 16:01 strideynet

@strideynet That was my concern too. I wonder if it's possible to analyze a response header/body to determine if the request actually failed or not. Are you aware of any known cases where Spotify returns 202 even though the request should be retried?

Wakeful-Cloud avatar Jan 07 '22 21:01 Wakeful-Cloud

I was planning on addressing this too, then saw this PR. I think given that StatusAccepted was added for a reason, a safer approach might be to instead change the retry checks in c.execute and c.get to include a check of the needsStatus:

if c.AutoRetry &&
   isFailure(resp.StatusCode, needsStatus) &&
   shouldRetry(resp.StatusCode) {
   // <retry logic>
}

rtrox avatar Dec 28 '22 23:12 rtrox

gah, sorry, just realized I'm necro-ing a year old PR. will open a new PR for this.

rtrox avatar Dec 28 '22 23:12 rtrox

#213 seems more complete, closing

Wakeful-Cloud avatar Dec 29 '22 00:12 Wakeful-Cloud