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

set a custom error on 429; affects [matrix twitch weblate] #9159

Merged
merged 2 commits into from
May 18, 2023

Conversation

chris48s
Copy link
Member

This PR is a follow up to #9155 but it is also the starting point of a slightly wider conversation.

I think I'm fairly convinced that this is a good idea for services where the user supplies an API key and we should actually do this on other services following this pattern. One thing I would quite like to do though is see if we can come up with a way to express this that clarifies that it is not us who has applied the rate limit and succinctly communicate that the rate limit which has been exceeded is that of the upstream service/user's API key, not shields.io.

In principle, we could set a custom error like this one level up (so it applies to all badges). 429 always means "too many requests". I'm slightly in 2 minds about this though. For services where the api key is supplied by the user this feels like more useful information/more likely to be actionable in some way. For a service that relies on anon access or a key we hold "centrally", its not really an actionable error. That said, its probably at least more informative. Any thoughts on this?

@chris48s chris48s added the service-badge Accepted and actionable changes, features, and bugs label May 10, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 10, 2023

Warnings
⚠️ This PR modified service code for matrix but not its test code.
That's okay so long as it's refactoring existing code.
⚠️ This PR modified service code for weblate but not its test code.
That's okay so long as it's refactoring existing code.
Messages
📖 ✨ Thanks for your contribution to Shields, @chris48s!

Generated by 🚫 dangerJS against e725868

@chris48s
Copy link
Member Author

Had a quick chat about this today.

Decided we are going to make it global (even if its our api key) and message should be "rate limited by upstream service"

Also consider impact on..
https:/search?q=repo%3Abadges%2Fshields%20429&type=code

@calebcartwright
Copy link
Member

Also consider impact on..
https:/search?q=repo%3Abadges%2Fshields%20429&type=code

Interesting. The Twitch one raised my eye 👀

@chris48s chris48s changed the title set a custom error for 429 on [uptimerobot] set a custom error on 429; affects [matrix twitch weblate] May 17, 2023
@chris48s
Copy link
Member Author

Yeah that twitch code is.. exciting.

The changes in this PR don't change anything about the way that code works. If we get a 429, we will still throw an InvalidResponse exception and statusCode will still be 429 so I'm going to leave that as it is for now.

@repo-ranger repo-ranger bot merged commit e3154f6 into badges:master May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge Accepted and actionable changes, features, and bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants