spotgen icon indicating copy to clipboard operation
spotgen copied to clipboard

Use an external Spotify library

Open epsil opened this issue 8 years ago • 1 comments

This project should use an external library for Spotify requests. Since it is rather request-intensive, throttling is an absolute must so that we don't butt up against Spotify's rate limits.

Currently, Spotify requests are handled by our own spotify.js layer, which depends on the http.js client to enforce limits. In practice, this is done with a setTimeout() call with a delay set to 100 ms.

The most promising replacement library seems to be spotify-web-api-node. Unfortunately, that library currently lacks options for HTTP throttling. Until this issue is resolved, we will, of necessity, stick with our own implementation for the time being.

epsil avatar Aug 08 '17 11:08 epsil

JMPerez, one of spotify-web-api-node's project owners, replied:

One option would be to have this built in, but we tried to keep the library as light as possible. What I have recommended in the past is to use something like https://github.com/JMPerez/promise-throttle. You can see an example of the library used together with the client-side Spotify JS wrapper on https://github.com/JMPerez/spotify-dedup/blob/b6091581e3700ccbb1e5a0e26dbb59422fa3d15f/app/scripts/main.js#L80.

epsil avatar Sep 06 '17 12:09 epsil