AudioScrobbler (ListenBrainz): API Compliance (User-agent & Rate Limiting)

オープン
#1,727 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
perl
領域
api, backend

調査の方向性

Read the AudioScrobbler ListenBrainz client and the LMS 9.2 retry handling mentioned in the issue, then trace how completed scrobbles and Now Playing requests are dispatched. Check the ListenBrainz API requirements linked in the issue for User-Agent contact details and rate limits. Done means requests share one-second pacing, 429 responses honor Retry-After with bounded retries, and unsent listens remain available for recovery; the issue notes that a pull request is planned.

索引モデルが issue の本文から書いたものです。

説明

Introduction

When I was trying to add ListenBrainz support to AudioScrobbler last time, I didn't quite get the rate limiting (1 per second) to work properly, and currently, the Retry-After header isn't being honored for 429 errors, nor is playback and scrobbling from multiple players at once being handled.
https://listenbrainz.readthedocs.io/en/latest/users/api/#id1

There is also a more detailed requirement regarding the inclusion of contact information in the User-Agent
https://listenbrainz.readthedocs.io/en/latest/users/api/#id5
https://github.com/metabrainz/listenbrainz-server/commit/eec17f1171f8335704c17b86361e90bc62c7673c

After all, back then the AI couldn't keep track of everything, and for the support of ListenBrainz provided by Lyrion I owe to major refactoring @mherger.

Describe the bug (AI analysis with personal verification)

  • When a completed scrobble receives HTTP 429, the error callback leaves the first item in the batch and schedules the same item again. The retry path has no attempt limit and ignores Retry-After.
  • Both the success and error paths schedule the next dispatch with time() + 0.1. The whole-second clock can place that deadline in the past. There is also no shared one-second interval across completed scrobbles and Now Playing.
  • The client inherits the LMS User-Agent. It identifies the server and version, but carries no maintainer contact. ListenBrainz asks clients to include a contact and keep calls at or below one per second.

To Reproduce (AI analysis with personal verification)

  1. Use a local HTTP fixture with two queued listens and a fake token. Accept the first listen and return HTTP 429 with Retry-After: 8 for the second.
  2. Observe the next timer deadline and submitted JSON. In an isolated replay through the LMS 9.1.1 response handler, the same second listen was sent again without the eight-second pause. A second 429 repeated the behavior.
  3. A separate observation from a local 9.1.1 server log showed a completed listen and a Now Playing dispatch 706 ms apart. Both succeeded.

@vysmaty note: In version 9.2, there is a limit of five failed attempts, but this is more of a safety measure.

**Expected behavior **

  • Give the ListenBrainz client an explicit User-Agent with its name, version and a maintainer contact URL or email.
  • Share a pacing budget across ListenBrainz operations, using a clock with subsecond precision. Start requests at least one second apart and honor server cooldowns before dispatching pending work.
  • Bound the retry loop and retain unsent listens so a temporary failure can be recovered without losing the batch.

System Information (please complete the following information):

  • Reproduced with LMS 9.1.1. The current 9.2 source adds a five-consecutive-error cap, but still uses the short default interval and inherits the server User-Agent.

Additional context
Thank you for your patience. And thanks for the fix that limits it to 5 attempts—I've had the server get overwhelmed with requests because of a failed scrobble... And I noticed that the issue had been resolved.

I've gone through the above and will prepare a pull request with help of Codex. It will be AI-generated code, but it looks good and passed the tests... and lots of my follow-up questions for quality.

主要言語
Perl
スター
1.8k
フォーク
389
平均マージ
1日 4時間
マージ済み PR(30日)
10

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

LMS-Community/slimserver のほかの issue

LMS-Community/slimserver の issue をすべて見る

似ている issue

Perl の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。