Skip to content

Update to respect MusicBrainz API rate limits #10

Description

@HAWK-6155

There is was an ongoing issue where SpotiFLAC is was getting users IP blocked by MusicBrainz due to sending metadata requests without respecting MusicBrainz's rate limits.

The solution from the original SpotiFLAC's dev is to "just use a VPN". However, not only is this unfair to MusicBrainz (their servers are literally getting overloaded), but MusicBrainz is evidently able to detect if traffic is coming from SpotiFLAC and block it accordingly (so using a VPN would only work for a very short time). When I contacted MusicBrainz support to ask why I was being blocked, I was informed it was because someone on my network was using SpotiFLAC.

SpotiFLAC has been updated with several features recently, among which is rate limiting to prevent IP bans from MusicBrainz. I'm not sure if it would be easier to re-fork from source or just implement rate limiting independently.

Documentation for MusicBrainz's API rate limits can be found here:
https://musicbrainz.org/doc/MusicBrainz_API/Rate_Limiting

In general, MusicBrainz allows:
50 requests per second (on average) per user agent,
1 request per second (on average) per IP address,
300 requests per second (on average) globally.

Anything over these limits gets HTTP 503'd.
IP addresses exceeding the average rate of 1 request per second are blocked until the rate stays below that limit for a period of time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions