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

Implement auto throttling #307

Merged
merged 28 commits into from
Oct 22, 2024
Merged

Implement auto throttling #307

merged 28 commits into from
Oct 22, 2024

Conversation

jordilin
Copy link
Owner

This pull request introduces several key improvements and refactorings related
to HTTP response handling, throttling, and caching:

Link and rate limit headers are now encapsulated in dedicated structures for
improved readability and usability. The responses have been split into
HttpResponse and ShellResponse, providing better separation of concerns.

A new throttle module has been added, providing a strategy for auto throttling

Local cache responses are excluded from throttling to optimize performance.

Both have different caracteristics and should be treated differently.
parse_page_headers is the public one that takes the Headers struct.
In the case that the remote does not provide rate limiting headers, then
update the response ones based on gitar defaults.
local_cache is a flag that is set when the response is retrieved from
the local cache. The use case is to disable throttling when the
response is retrieved from the local cache.
Copy link

codecov bot commented Oct 22, 2024

Codecov Report

Attention: Patch coverage is 88.44622% with 87 lines in your changes missing coverage. Please review.

Project coverage is 86.21%. Comparing base (adfbe06) to head (af7ed49).
Report is 29 commits behind head on main.

Files with missing lines Patch % Lines
src/http/throttle.rs 14.28% 71 Missing and 1 partial ⚠️
src/io.rs 94.68% 3 Missing and 2 partials ⚠️
src/backoff.rs 97.32% 1 Missing and 2 partials ⚠️
src/remote/query.rs 95.83% 2 Missing ⚠️
src/cache/inmemory.rs 75.00% 1 Missing ⚠️
src/cache/nocache.rs 50.00% 1 Missing ⚠️
src/git.rs 97.43% 1 Missing ⚠️
src/remote.rs 94.11% 1 Missing ⚠️
src/shell.rs 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #307      +/-   ##
==========================================
- Coverage   86.60%   86.21%   -0.39%     
==========================================
  Files          68       69       +1     
  Lines       16453    16870     +417     
  Branches    16453    16870     +417     
==========================================
+ Hits        14249    14545     +296     
- Misses       2023     2138     +115     
- Partials      181      187       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jordilin jordilin merged commit 688e033 into main Oct 22, 2024
5 checks passed
@jordilin jordilin deleted the autothrottle branch October 22, 2024 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto throttle when num pages requested > threshold and client has not activated any throttling mechanisms
1 participant