Skip to content

Commit

Permalink
fixes problem with ratelimits when requesting huge playlists from spo…
Browse files Browse the repository at this point in the history
…tify
  • Loading branch information
crohrer committed Nov 12, 2017
1 parent e1b027d commit 926665b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions spotifyPlaylist.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,14 @@ function getTracks(playlistName, offset){
let data = '';

if(res.statusCode !== 200) {
spotifyHelper.checkForRateLimit(res, 'requesting playlist tracks', () => spotifyPlaylist.getTracks(playlistName, offset))
spotifyHelper.checkForRateLimit(res, 'requesting playlist tracks', () => resolve(spotifyPlaylist.getTracks(playlistName, offset)))
.then(() => {
if(res.statusCode === 401){
spotifyOAuth.refresh()
.then(require('./main').start);
} else {
} else if(res.statusCode !== 429) {
var error = "Error getting tracks from playlist. Status "+res.statusCode;
logger.log(error, playlistName);
reject(error);
process.exit(1);
}
});
Expand Down

0 comments on commit 926665b

Please sign in to comment.