Repository navigation
Retry requests that Overleaf rate limits (HTTP 429) - #63
Merged
Merged
Conversation
Overleaf answers bursts with 429 before doing anything, so a retry is safe for every method. Wait 1, 2, 4, 8 and 16 s with jitter, or Retry-After when sent. The extra pool sockets opt out, so a rate-limited pool still shrinks at once.
A Retry-After value from the server was used as is, so a 429 with Retry-After: 3600 would make olcli wait an hour before the retry. The wait from Retry-After is now capped at 60 seconds; a missing, non-numeric or negative value falls back to the exponential backoff as before. The computation moves into retryDelayMs, and a test next to the existing 429 test checks the cap both on the helper and end to end with a server sending Retry-After: 3600 and a stubbed setTimeout.
# Conflicts: # CHANGELOG.md
Owner
|
Thanks, merged. Before merging I added one commit that caps Retry-After at 60 seconds, with a test next to yours. Ships in 0.17.0. |
aloth
added a commit
that referenced
this pull request
Nov 15, 2026
This was referenced Nov 20, 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.
Overleaf answers a burst of requests with HTTP 429, and the limit lasts about 25 seconds. A command that sends a few requests in a row (adding a comment and then reading the threads back, for example) can fail with "Overleaf is rate limiting requests" although waiting a little would have worked.
Change
httpRequestnow retries a 429 up to 5 times, after 1, 2, 4, 8 and 16 seconds (about 30 s in all), with ±25% jitter so parallel requests don't retry in step. When Overleaf sendsRetry-After, that wins. A 429 is sent before anything is done, so the retry is safe for every method.--verboselogs each retry.The extra sockets of the doc-joining pool opt out (
retryOn429: false): the pool already drops a socket that gets a 429, and making each one wait 30 s first would undo that. The first socket still retries, because the pool can't work without it.Tests
npm testgoes from 240 to 241. The new test runs a local HTTP server that answers 429 withRetry-After: 0: two 429s then a 200 gives 200 after 3 requests, a server that never stops gives 429 after 6, andretryOn429: falsegives 429 after 1. Lint is unchanged at 76 warnings. CHANGELOG entry included.What I haven't verified
Retry-After; that branch is only covered by the local test.