Search: download version with rclone before indexing - #13246
Draft
ericholscher wants to merge 1 commit into
Draft
Conversation
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.
index_buildcurrently fetches every HTML page from storage one at a time. New Relic shows this is ~83% of the task's runtime — an average transaction spends 15.3s on 730 serial S3 round-trips (319 GETs + 411 HEADs) and only 73ms on Elasticsearch. Big versions take minutes per build, which held all the shared web/reindex worker slots and caused the recurring web-celery queue spikes (readthedocs/readthedocs-ops#1832 has the incident details).This downloads the whole version once with
rclone copy(parallel transfers, no per-file HEADs) into a temp dir and parses from the local copy.rclone_download_directorymirrors the existingrclone_sync_directory, so it works for both storage backends — and .com's storage class inherits it.Things to double-check:
HTMLFile.processed_json, socollect()now runs inside the temp dir context; the injected parser resolves paths relative to the local copy.$TMPDIR, deleted on exit. Worth a sanity check on p99 version size vs instance disk.search-marked tests (test_imported_file.py) exercise the new path end-to-end in CI; they need ES so they didn't run locally. Storage and parser tests pass locally on 3.14 with real rclone.🤖 Generated with Claude Code