zmb3 / spotify

A Go wrapper for the Spotify Web API
Apache License 2.0
1.33k stars 284 forks source link

Cannot Set Playlist Image With Autoretry #182

Closed Wakeful-Cloud closed 1 year ago

Wakeful-Cloud commented 2 years ago

Version

Issue

When I invoke client.SetPlaylistImage without client.WithRetry, everything works and the playlist image updates. When I invoke client.SetPlaylistImage with client.WithRetry, the playlist image is updated but client.SetPlaylistImage returns "io: read/write on closed pipe".

Expected Behavior

client.SetPlaylistImage should work the same with or without autoretry

Possible Cause

The API endpoint (PUT /playlists/{playlist_id}/images) returns 202 Accepted (Regardless if autoretry is enabled or not) which is then retried because of shouldRetry. The reason that it works without autoretry is this if statement. I'm not entirely sure if the problem is Spotify returning an unexpected response (Please note that this library seems to anticipate the 202 response here) or the condition in shouldRetry.

It seems this may have been discussed in #100 (Specifically this comment)