Repository navigation
Seed Search images: a deadline they can meet, and a log of late ones - #638
Merged
Merged
Conversation
In production every images=true search missed IMAGE_SEARCH_GRACE_SECONDS: phase 1 runs the Commons search (about 1s) and then the NSFW request in turn, while web ranking on a cached Staan answer takes 0.6-1.2s, and 0.25s of grace wasn't enough. Raise the default to 1.0s, read it from the environment so it can be tuned without a deploy, and log when a search that missed its deadline finished, with neither the query nor the images, so the setting can be tuned from production. No functional changes to the crawler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
From Claude:
What changed
IMAGE_SEARCH_GRACE_SECONDSnow comes from the environment and defaults to 1.0s, up from 0.25s.seed_images.finishnow attaches a done callback to the still-running selection. When the selection finishes, it logsLate images <outcome>: finished N.NNNs after web ranking, with neither the query nor the images.Why
After #631 was deployed, 4 of the 5
images=truetest searches the rules let through came backunavailablein production (the fifth finished in time). A check script run against api.mwmbl.org showed it. The logs show all 4 were missed deadlines, exactly 0.25s after web ranking:Phase 1 is sequential: the Commons search, then the NSFW request.
latency_sof the eval's 1,199 collected queriesSo phase 1 needs about 1.35s at p50. Web ranking on a cached Staan answer took 0.6–1.2s in the production logs. The evaluations measured each request on its own, but never phase 1 against web ranking end to end.
1.0s should cover most searches, though not the slowest Commons searches. A search with images can now take up to 1s longer than web search alone. One without images is unaffected: the grace applies only when
images=true, and only while phase 1 is still running. The "Late images" line shows how far over the misses are, so the setting can be tuned from real numbers. SettingIMAGE_SEARCH_GRACE_SECONDSin the environment changes it without a deploy.How verified
make checkpasses.make testpasses (1883 passed, 10 skipped). The test was tightened afterwards, andtest/test_seed_images.pywas re-run on the final code (19 passed).wait_fortimeout), privacy and style. It found nothing blocking. Fixed:Part of #610
🤖 Generated with Claude Code