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

Add the ability to handle error 429 (too many requests) in Spotify plugin #4369

Closed
arsaboo opened this issue Jun 12, 2022 · 1 comment · Fixed by #4370
Closed

Add the ability to handle error 429 (too many requests) in Spotify plugin #4369

arsaboo opened this issue Jun 12, 2022 · 1 comment · Fixed by #4370
Labels
feature features we would like to implement

Comments

@arsaboo
Copy link
Contributor

arsaboo commented Jun 12, 2022

Spotify has a rate-limiting feature. If there are too many requests to the Spotify App it will prevent you from sending further requests. Fortunately, the response includes the retry-after value that we should be using to back off.

I am just creating this issue so that we can keep a track of it based on @wisp3rwind comment here.

Here are some reference links to implement this feature:
skuethe/MMM-Spotify#172
felix-hilden/tekore#163

@sampsyo
Copy link
Member

sampsyo commented Jun 12, 2022

Good idea! An ideal implementation of rate limiting would work by measuring the time since the last call to the function—if the calls are naturally spaced out by some other work to be done, then there should be no need to sleep at all.

Something along the lines of the rate-limiting in the MusicBrainz library we use:
https://github.com/alastair/python-musicbrainzngs/blob/1638c6271e0beb9560243c2123d354461ec9f842/musicbrainzngs/musicbrainz.py#L376

…although I wrote that code a very long time ago, and maybe there are better Python stdlib facilities for this kind of pattern now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature features we would like to implement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants