fix(lookup-client): raise per-attempt timeout to 20s; stop retrying on TimeoutException#159
Merged
Merged
Conversation
…g on TimeoutException The default per-attempt timeout of 10s plus retry-on-TimeoutException turned any cold-path LML lookup past 10s into a Slack "Search unavailable" post and simultaneously fired a duplicate lookup at LML. The duplicate ran concurrently with the still-in-flight first attempt (LML can't cancel work when the rom socket disconnects), doubling Discogs and Apple Music fan-out for the same prompt. Bump per_attempt_timeout 10 -> 20 to cover the long-tail of cold-path walks (4 sequential Discogs release validations + Apple Music fallback), and drop TimeoutException from the retry set so a single slow lookup fails fast rather than spawning a concurrent duplicate. ConnectError is still retried, since that is the case the retry was designed for. Closes #158
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
LookupServiceClient.per_attempt_timeoutfrom 10s → 20s so cold-path LML lookups (sequential Discogs release validations + Apple Music fallback) have room to return successfully before rom drops to thesearch_unavailabledegraded mode.httpx.TimeoutExceptionfrom_RETRYABLE. A lookup that already burned the full per-attempt budget is doing real work on LML's side and will not be faster on retry; the concurrent duplicate doubles LML's Discogs + Apple Music fan-out because LML cannot cancel work when the rom socket disconnects.ConnectErroris still retried, since that is the case the retry was designed for.Closes #158
Test plan
pytest tests/unit/— 503 passing locally.ruff check+ruff format --checkclean on touched files.mypy services/lookup_client.py tests/unit/test_lookup_client.pyclean.POST /api/v1/requestwithWhale song - modest mouse(the original incident prompt) to confirm a single in-flight LML call and a non-degraded Slack post.