ahampe / KDVS

Android app for streaming 90.3 FM in Davis, CA, live from anywhere
1 stars 0 forks source link

MusicBrainz rate limiting workaround #67

Open rpeg opened 4 years ago

rpeg commented 4 years ago

MusicBrainz has very restrictive rate limits (1 per second max), so many of our calls to their API are returning errors, since we fetch TopMusic metadata en masse:

[WDHMBT]{"error": "Your requests are exceeding the allowable rate limit. Please see http://wiki.musicbrainz.org/XMLWebService for more information."}

I successfully deployed a custom clone of the MusicBrainz database to Heroku for a recent NodeJS project (https://github.com/scjohnson16/mb-server), so this may be an option. It's technically possible to fit the entire Releases table into the memory limit of a free Heroku deployment, but then we'll be restricted to a static database which is not ideal for new releases.

The only other option I see is to schedule requests at one second intervals, though this is also pretty unrealistic for a real-time case. Otherwise we'll have to simply limit ourselves to Spotify metadata.