Repository navigation
fix(traffic): use a bot's range list while it is read again - #1254
Merged
gkhngyk merged 1 commit intoOct 20, 2026
Merged
Conversation
Once a day, when a range list was past its TTL, the requests that needed it waited for the refresh even though a usable list was still in memory. They now use that list at once while the one shared read runs; only a request with no list to use waits for it. Follow-up to gkhngyk's note on ansvisor#1251. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
Author
gkhngyk
approved these changes
Oct 20, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good. A list past its day is used at once while the one read runs in the background, and readRanges catches its own errors, so nothing is left unhandled. Only a request with no list waits.
7 of 12 tasks
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
Follow-up to gkhngyk's optional note on #1251: "once a day, when a list is older than its TTL and a refresh is under way, requests wait for that refresh even though a usable list is still in memory. Returning the stale list right away while the refresh runs would remove that wait."
rangesFor(server/src/lib/ai-bots.js) now returns the list it has (hit.prefixes) at once when that list is past its day, while the one shared read runs. Only a request with no list to use (a first read, or the 5-minute retry after a failed one) waits for that read. A failed refresh still keeps the old list for an hour.Related issue
Follow-up to #1251.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
ai-bots.test.js, new: a list read at 0 and asked for past its TTL, while the refresh hangs, comes back at once twice with one refresh under way. Once the refresh answers, the new list is used. On the old code the request waits for the refresh and the test times out.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/) — web not touchedyarn typecheckpasses (run fromweb/) — web not touchedyarn format:checkpasses (run fromweb/) — web not touchedServer:
npm run format,npm run lint,npm test(1905) pass.🤖 Generated with Claude Code