Repository navigation
Refresh Babel discovery in the background and cache status health - #56
Merged
Merged
Conversation
shuchenliu
commented
Oct 24, 2026
shuchenliu
left a comment
Member
Author
There was a problem hiding this comment.
claude review: Reviewed 57e92bc: no issues found.
What I checked:
- Background refresh: discovery builds a complete
BabelReleasessnapshot and publishes it with noawaitbetween the writes. A failed or timed-out discovery keeps the previous snapshot, setsrefresh_error, and retries after 30 s. Resolving the default release can't fail after a successful discovery (the constructor rejects an unavailable default), so nothing outside thetrycan end the refresh loop. - Request pinning: each handler resolves its release once (
handlers/base.py) and threadsrelease.search_indicesthroughget_normalized_nodes→_lookup_curie_metadata→_lookup_equivalent_identifiersandgenerate_setid. Theelasticsearch.indicesfallback is never reached from those handlers, so a refresh mid-request can't mix releases. - Health cache: one shared, cancellation-shielded probe with 5 s / 1 s TTLs and a 3 s deadline. The probe's
filter_path(*.mappings._meta.src.nodenorm) covers everythingget_babel_versionreads, and the cache is rebuilt when the default release changes. - Target selection:
_discover_babel_releasesuses the same index-then-alias logic as the startup_validate_elasticsearch_index. - Tests: 244 pass with outbound network blocked. The 4 live-Elasticsearch handler tests (
test_set_identifiers,test_normalized_nodes) fail identically at the base commit, so they depend on the environment rather than this change.
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.
Babel discovery currently runs only at startup. This change refreshes it every 10 minutes so new releases and default-alias changes become available without restarting the API.