A 429 from the Audible API reads as "no metadata" to every caller

未关闭
#960 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
csharp
领域
api, backend

调研方向

Start with MetadataRegistrationExtensions.cs and AudibleApiClient.cs to trace how HTTP failures and status codes are handled; then inspect the cited callers in the rescan, ASIN lookup, and title-search workflows. Compare TorrentFileDownloader.cs:183-195 for the existing Retry-After approach. Done when a throttled Audible response is distinguishable from missing metadata and can be retried or deferred without changing the separate rescan cooldown behavior.

由索引模型根据 Issue 内容生成。

描述

p2

All line references are at a630572e.

What a user sees

A book that exists on Audible comes back "No metadata found using the available identifiers." from a rescan, and the same ASIN works a minute later. It shows up during a burst of lookups rather than on a single one. The only trace is one warning line from the HTTP client naming the status code. Nothing downstream says the provider throttled us, so the symptom is identical to a book that has no catalog entry at all.

The code path

AudibleService gets its typed HttpClient with a Polly policy built from HandleTransientHttpError (listenarr.infrastructure/DependencyInjection/Metadata/MetadataRegistrationExtensions.cs:25-29). That extension covers HttpRequestException, 5xx and 408, not 429, so a throttled request is never retried.

That same client is handed to AudibleApiClient (listenarr.application/Metadata/Audible/AudibleService.cs:44), where any non-success status logs a warning and returns null (AudibleApiClient.cs:83-87), so the status code stops there.

Callers then read null as absence:

  • LibraryMetadataRescanWorkflow.cs:169 calls GetMetadataAsync; null becomes a 404 carrying that message at :289-291.
  • AsinLookupService.cs:115-118 turns null straight into the string "Metadata not found".
  • SearchByTitleWorkflow.cs:103-109 logs "returned null" and falls through to intelligent search.

Why it matters

AudibleService.cs:177-182 fetches metadata per candidate in a loop, and the refresh and monitoring paths sweep many books in one pass, so bursts are routine. Under throttling a whole sweep reports nothing found.

Worth keeping apart from this: the rescan endpoint emits a 429 of its own, a per-actor 15 second cooldown with a Retry-After (LibraryMetadataRescanWorkflow.cs:27, :85 and :92-99), a different mechanism sharing a status code.

What I think the fix looks like

Surface the status instead of flattening it: an exception, or a typed result carrying the status code, so callers can defer rather than record an absence. Then let the policy handle 429 with a Retry-After-aware delay. TorrentFileDownloader.cs:183-195 already does that in this repo and could be the shape to copy.

Before anyone sends a PR: typed result or exception? AudibleApiClient sits in the area #635 proposes reworking, so I would rather not pick for you. Related but distinct: #638 covers 429 on the indexer side.

This is from reading the source. I have not reproduced it against the live Audible API.

Disclosure: drafted with Claude Code at my direction; I read the cited code at the stated commit and reviewed this before posting.

主要语言
C#
星标
901
派生
70
平均合并
16 小时 27 分钟
30 天内合并 PR
60

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Listenarrs/Listenarr 的其他 Issue

查看 Listenarrs/Listenarr 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。