Repository navigation
feat(clob): retry rate-limited reads and report rate-limit updates - #31
Merged
SebastianBoehler merged 5 commits intoOct 7, 2026
Merged
Conversation
yluoc
marked this pull request as draft
October 7, 2026 16:01
yluoc
marked this pull request as ready for review
October 7, 2026 17:05
Contributor
Author
|
@SebastianBoehler this PR is a minor change, no need to be released or be tagged. Thanks. |
Owner
|
Thanks again for the contribution! LGTM |
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.
Summary
The SDK classified HTTP 429 as
RateLimitbut never retried, ignoredRetry-After, and dropped thePoly-RateLimit-*headers.Retry-Afterdelay (1 s when absent). A requested delay above 5 s returns the error instead. Configure withset_rate_limit_retry(),PositionClientConfig::rate_limit_retryorConfig::rate_limit_retry;std::nulloptdisables.ClobClientreads (batch POST reads included), the Data API, thePositionClientGamma lookup, relayer nonce and status reads, andMarketFetcher. Signed reads rebuild their L2 headers on every attempt./submitand other writes.SdkErrorgainsretry_after_seconds(seconds, HTTP date, or theretry_after_secondsbody field) andrate_limit.ClobClient::set_rate_limit_listener()receives thePoly-RateLimit-*state from order and cancel responses, tagged with an order or cancel bucket.Verification
Commands run and their actual results:
ctest --test-dir build -LE live(Linux Release): 56 of 56 passed. New tests:test_rate_limit,test_clob_rate_limitandtest_position_rate_limit.test_clob_rate_limitrun 25 times in a row: 25 of 25 passed.scripts/quality.py: C++ checks passed./orderlistener hook, disabling the default policy, reusing prebuilt L2 headers on a retry, and ignoring theMarketFetcherpolicy.Checks not run and the reason (or none):
README.md: no Node runtime was available locally. CI runs it.Compatibility and evidence
Public API, binary compatibility, or release implications (or none):
set_rate_limit_retry(std::nullopt).SdkError,ClobClient,ConfigandPositionClientConfiggrew. New fields go at the end, so existing positional brace initializers ofSdkErrorstill compile.polymarket/rate_limit.hpp(RateLimitUpdate,RateLimitRetry) and the twoClobClientsetters.For protocol changes: the retry policy and header parsing follow py-sdk
_internal/retry.pyatac69106andrate_limit.pyat9fec251, and ts-sdkretry.tsatd02b337andrate-limit.tsatc9106d4.For live checks: no live calls were made. All behavior is covered by local fixture servers.