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

Fix 429 errors on OVSX requests #14030

Merged
merged 5 commits into from
Aug 13, 2024
Merged

Fix 429 errors on OVSX requests #14030

merged 5 commits into from
Aug 13, 2024

Conversation

msujew
Copy link
Member

@msujew msujew commented Aug 9, 2024

What it does

After #13825 we started having a few 429 errors (and adopters as well) when downloading plugins from extension packs.

This change correctly propagates the OVSX rate limit through all layers of the application including the runtime. This can be seen in the ovsx-http-client.ts file changes. This should ensure that users never hit 429 errors from OVSX. If they do, they can use a lower rate limit via a CLI option.

How to test

I've upped the rate limit in the CI - the CI should run successfully.

Also, simply running the theia download:plugins CLI command should run without errors.

Review checklist

Reminder for reviewers

@msujew msujew added the open-vsx issues related to the open-vsx registry label Aug 9, 2024
@msujew msujew requested a review from tsmaeder August 9, 2024 10:57
@tsmaeder
Copy link
Contributor

tsmaeder commented Aug 9, 2024

Could you explain a bit how #13825 lead to the 429 errors? After all, we did not rate limit before and we didn't after. Did we just increase the number of requests?

@msujew
Copy link
Member Author

msujew commented Aug 9, 2024

Did we just increase the number of requests?

@tsmaeder Yes, exactly :) After #13825, we perform 2 requests for every query request - one with and one without the targetPlatform parameter. So even if the outer loop performs rate limiting, we still hit the ovsx servers twice as hard and therefore get 429 responses in return.

@tsmaeder
Copy link
Contributor

I just ran yarn download:plugins with the PR branch and I'm getting three 429 errors. Either we're still not rate-limiting properly or rate-limiting is broken on the open-vsx side. 🤷‍♂️

@msujew
Copy link
Member Author

msujew commented Aug 13, 2024

@tsmaeder I've added exponential backoff to our requests. I think this should work around the issues of open-vsx reasonably well.

if (context.res.statusCode === 429) {
// If there are still more attempts left, retry the request with a higher token count
if (i < attempts - 1) {
continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a last nitpick, can we get a warning if we ran into 429's even if we eventually succeed? IMO it's important info also for open-vsx.

@msujew msujew requested a review from tsmaeder August 13, 2024 11:57
@msujew msujew merged commit a9345da into master Aug 13, 2024
14 checks passed
@msujew msujew deleted the msujew/fix-ovsx-429 branch August 13, 2024 12:56
@github-actions github-actions bot added this to the 1.53.0 milestone Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-vsx issues related to the open-vsx registry
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants