Skip to content

fix(lookup-client): raise per-attempt timeout to 20s; stop retrying on TimeoutException#159

Merged
jakebromberg merged 1 commit into
mainfrom
lookup-timeout-bump-158
Jun 9, 2026
Merged

fix(lookup-client): raise per-attempt timeout to 20s; stop retrying on TimeoutException#159
jakebromberg merged 1 commit into
mainfrom
lookup-timeout-bump-158

Conversation

@jakebromberg

Copy link
Copy Markdown
Member

Summary

  • Raise LookupServiceClient.per_attempt_timeout from 10s → 20s so cold-path LML lookups (sequential Discogs release validations + Apple Music fallback) have room to return successfully before rom drops to the search_unavailable degraded mode.
  • Drop httpx.TimeoutException from _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. ConnectError is 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 --check clean on touched files.
  • mypy services/lookup_client.py tests/unit/test_lookup_client.py clean.
  • Staging deploy + manual spot-check of POST /api/v1/request with Whale song - modest mouse (the original incident prompt) to confirm a single in-flight LML call and a non-degraded Slack post.

…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
@jakebromberg jakebromberg merged commit f0363ce into main Jun 9, 2026
7 checks passed
@jakebromberg jakebromberg deleted the lookup-timeout-bump-158 branch June 9, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bump LML lookup timeout; reconsider retry on TimeoutException

1 participant