Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with Spotify Web API rate limiting #29

Closed
hrkfdn opened this issue Mar 12, 2019 · 3 comments
Closed

Deal with Spotify Web API rate limiting #29

hrkfdn opened this issue Mar 12, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@hrkfdn
Copy link
Owner

hrkfdn commented Mar 12, 2019

Users with a lot of playlists that contain a large amount of tracks may encounter rate limits imposed by Spotify.

We should respect the Retry-After header: https://developer.spotify.com/documentation/web-api/#rate-limiting

By quick look it seems that the Spotify Web API crate we use does not handle the 429 response. It does return an Error, though. If that contains the Retry-After header information we can kick off another request once the desired waiting time has passed.

@hrkfdn hrkfdn added the bug Something isn't working label Mar 12, 2019
@norcalli
Copy link

One way to reduce the number of requests being sent in the first place is to debounce the "play" event by a small interval like <= 1s, because if you, for instance, press "next" or "previous" a lot of times in quick succession, then you'll make a lot of unnecessary requests. I find I frequently run into this, which causes the audio to blank out while the API tries to fetch the song.

@hrkfdn
Copy link
Owner Author

hrkfdn commented Mar 13, 2019

Ah, good point. I never had it during playback, only when downloading playlist data. It's a little bit problematic, that rate limiting is applied per client ID and independent on the amount of users.. 😞

@hrkfdn
Copy link
Owner Author

hrkfdn commented Mar 20, 2019

Requires ramsayleung/rspotify#36 to be merged upstream

@hrkfdn hrkfdn closed this as completed in 2b45778 Mar 20, 2019
mtshrmn referenced this issue in mtshrmn/ncspot Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants