Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
external-sources: throttle requests to maven central to avoid being r…
…ate limited for large sets of java dependencies (#2384) * external-sources: throttle requests to maven central to avoid being rate limited for large sets of java depenencies When [external-sources](https://github.com/anchore/grype?tab=readme-ov-file#external-sources) are enabled if an Image contains a large number of Java dependencies Grype can get rate limited by maven central. This change will: - add a rate limiter to throttle requests at 300ms per second to produce reliable results - if a normal artifact not found error is returned by maven central the existing debug logging happens - any other error from maven central will result in an error being logged - adds an integration test that can be used to verify the rate limiter so we can verify against the real external api settings Related to issue #2383 Signed-off-by: James Rawlings <[email protected]> * incorporate review feedback, add a unit test for the rate limiter behaviour Signed-off-by: James Rawlings <[email protected]> * fix linting issues Signed-off-by: Alex Goodman <[email protected]> --------- Signed-off-by: James Rawlings <[email protected]> Signed-off-by: Alex Goodman <[email protected]> Co-authored-by: Alex Goodman <[email protected]>
- Loading branch information