mirror of
https://github.com/ramsayleung/rspotify.git
synced 2026-04-26 07:55:55 +03:00
[GH-ISSUE #309] Rate limit causing HTTP Error 429 #92
Labels
No labels
Stale
bug
discussion
enhancement
good first issue
good first issue
help wanted
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/rspotify#92
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Marekkon5 on GitHub (Apr 2, 2022).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/309
Describe the bug
You can still hit the rate limit, which causes HTTP status 429.
To Reproduce
Make a loop doing single request such as search. This is kinda hard to reproduce, because it depends on your internet connection, and also luck (Spotify servers might be busy = slower = won't reach the rate limit). In our case it happened randomly after spamming the API for few hours.
Expected behavior
rspotifyshouldn't hit it, or retry in case it happens, not return an error.Log/Output data
http error: status code 429Additional context
I don't know where the rate limit handling is implemented or how it's implemented.
@marioortizmanero commented on GitHub (Apr 2, 2022):
I honestly don't think rate limiting is something rspotify itself should handle. If your client gets one of these, just wait for the indicated amount of time and retry again.
@Marekkon5 commented on GitHub (Apr 2, 2022):
In that case why isn't there any helper method or error type which would contain the
Retry-Afteramount to make it more user friendly?@marioortizmanero commented on GitHub (Apr 2, 2022):
The thing is that it was quite hard to wrap all the errors under the same interface. Since we now support both ureq and reqwest, they are reported in different ways depending on what client you're using. It's certainly possible, but for the first version I chose the easiest option and just left the original error types. For now you can check reqwest/ureq's documentation and see how they handle these errors yourself. We could try to wrap the errors in the future, but I remember that it was somewhat complicated when I tried.
@ramsayleung commented on GitHub (Apr 4, 2022):
I agree with Mario's point, rspotify should be a lightweight rust wrapper for the Spotify Web API, instead of an all-in-one clumsy library.
The rate limit error isn't raised from
rspotify,rspotifyjust propagates this error from Spotify Server to client. Andrspotifyshould not cover this up for Spotify Server or handle it for client.