Repository navigation
fix(search): retry Keenable fetch on 429 using Retry-After - #670
Closed
ilya-bogin-keenable wants to merge 1 commit into
Closed
ilya-bogin-keenable wants to merge 1 commit into
ilya-bogin-keenable wants to merge 1 commit into
Conversation
Keenable enforces a per-second rate limit (10 rps keyless, per org when keyed) and answers bursts with 429 and Retry-After. scrapeUrls fetches every link at once, so a burst lost pages. Retry a 429 up to twice, waiting Retry-After seconds (1s fallback, 3s cap) plus jitter. Other errors are not retried.
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.
Keenable's fetch API has a per-second rate limit (10 rps on the keyless endpoint, per org when keyed) and answers a burst with HTTP 429 and
Retry-After: 1.KeenableScraper.scrapeUrlsfetches every link at once and never retries, so a burst loses pages. A self-hosted LibreChat user hit this and moved page fetching to Firecrawl (maxexcloo/kubelab#619):This PR retries a 429 up to twice per URL. It waits
Retry-Afterseconds (1s if the header is missing, capped at 3s) plus up to 500 ms of jitter so the retries don't land together. Any other error fails at once, as before, and no other scraper, default or config changes. New unit tests cover a 429 followed by a 200, three 429s in a row (reported as a failure, as today),Retry-Afterbeing honored, capped and falling back (fake timers), and a 500 not being retried.Live check through
KeenableScraper, keyless, 15 Wikipedia URLs at once: before the change 10/15 succeeded and 5 failed with 429. After it, 15/15 succeeded in about 2.3s, with 5 requests retried once.