ratelimit timestamps - #22292
Closed
icing wants to merge 4 commits into
Closed
Conversation
Remove the timestamp passed for ratelimit checks. Let the limit calculation obtain a timestamp when it needs it. Most transfers run without active ratelimits and getting a fresh timestamp is unnecessary.
vszakats
approved these changes
Jul 10, 2026
Contributor
Author
Flüchtigkeitsfehler...😌 |
bagder
approved these changes
Jul 12, 2026
There was a problem hiding this comment.
Pull request overview
This PR makes timestamps optional for rate-limit (token bucket) checks/drains by letting the ratelimit code sample the current time internally when needed, reducing timestamp reads on transfers where rate limiting is inactive. It also updates various call sites accordingly and extends an HTTP test scorecard formatter to display GB/s.
Changes:
- Allow
Curl_rlimit_avail()/Curl_rlimit_drain()to accept aNULLtimestamp and sample time internally only when rate limiting is active. - Update multiple protocol/transfer paths to pass
NULLtimestamps into ratelimit functions. - Adjust progress timestamp handling and add GB/s formatting support in
tests/http/scorecard.py.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/http/scorecard.py | Adds GB/s formatting to the scorecard throughput formatter. |
| lib/vquic/cf-ngtcp2.c | Switches QUIC RX window updates to call ratelimit availability without a caller-supplied timestamp. |
| lib/vquic/cf-ngtcp2-proxy.c | Same ratelimit timestamp change for the HTTP/3 proxy QUIC path. |
| lib/transfer.c | Updates download path ratelimit availability check to omit timestamp. |
| lib/sendf.c | Updates upload path ratelimit availability check to omit timestamp. |
| lib/ratelimit.h | Minor signature formatting change for Curl_rlimit_drain() declaration. |
| lib/ratelimit.c | Implements optional timestamp sampling in Curl_rlimit_avail() and Curl_rlimit_drain(). |
| lib/progress.c | Simplifies Curl_pgrs_now() storage and switches ratelimit drain calls to omit timestamp. |
| lib/multi.c | Updates pollset adjustment logic to call ratelimit availability without an explicit timestamp. |
| lib/http2.c | Updates HTTP/2 desired window computation to call ratelimit availability without an explicit timestamp. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
vszakats
approved these changes
Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Make timestamp passed for ratelimit checks optional arguments. Let the limit calculation obtain a timestamp when it needs it and none was passed. Most transfers run without active ratelimits and getting a fresh timestamp is unnecessary.