VcsRepository: do not continue when receiving 429 rate limit exception #10132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently Composer ignores all TransportExceptions (except 401 and 403) while fetching composer.json files to import all available versions and then skips those versions.
This pull request changes this behaviour for rate limit errors with a 429 status code. After a rate limit error response was received all future requests to that resource will most likely receive the same error status code which make it unlikely that Composer is able to finish the command.
Sample Composer output for such a scenario:
I do wonder whether the behaviour in the VcsRepository should be changed in general and abort for most errors including 5XX errors and curl errors. A VcsRepository that doesn't receive all available versions can lead to an unexpected result of a Composer command e.g. composer update might unexpectedly downgrade a package because the request to fetch the composer.json file of the latest tag returned a 500 response.