Coder Social home page Coder Social logo

bearni95 / spotify-web-api-node Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thelinmichael/spotify-web-api-node

0.0 2.0 0.0 425 KB

Fork of spotify-web-api-node to prevent error 429 - Too many requests

Home Page: https://github.com/thelinmichael/spotify-web-api-node

License: MIT License

JavaScript 100.00%

spotify-web-api-node's Introduction

Spotify Web API Node - Performance Optimizations

This is a fork from the Spotify Web API Node

The fork was made to implement a solution to the common Web Api Error 429 - Too many requests using superagent (Spotify Web API Node's HTTP client) plugins.

The first lines in src/http-manager.js have changed from:

'use strict';

var superagent = require('superagent'),
    WebApiError = require('./webapi-error');

var HttpManager = {};

To:

'use strict';

var superagent = require('superagent'),
    WebApiError = require('./webapi-error');

require('superagent-cache')(superagent);

var Throttle = require('superagent-throttle');
var throttle = new Throttle({
    active: true,     // set false to pause queue
    rate: 10,          // how many requests can be sent every `ratePer`
    ratePer: 1000,   // number of ms in which `rate` requests may be sent
    concurrent: 2    // how many requests can be sent concurrently
})

var HttpManager = {};

The superagent-cache plugin was implemented to minimize the network usage of redundant requests.

The superagent-throttle plugin takes care of spacing the HTTP requests. The shown settings are the ones we found adequate for our project but feel free to alter them to match your porpuses.

spotify-web-api-node's People

Contributors

bearni95 avatar dolcalmi avatar hughrawlinson avatar jeremyboles avatar jgranstrom avatar jmperez avatar krishorowitz avatar louiswilliams avatar madeddie avatar matiassingers avatar nate-wilkins avatar neelvirdy avatar philnash avatar someoneweird avatar the-eater avatar thelinmichael avatar vincentorback avatar yehya avatar zhuwxyz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.