Skip to content

Commit

Permalink
#32 fixed 'sleep_duration' variable use inside function handleRateLimit
Browse files Browse the repository at this point in the history
  • Loading branch information
mef committed Aug 18, 2013
1 parent e0bcc35 commit aea178f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/tuiter.js
Expand Up @@ -194,12 +194,12 @@ Tuiter.prototype.resetTimers = function() {
Tuiter.prototype.handleRateLimit = function(res) {
var self = this;
self.sleep_duration = (res.header['x-rate-limit-reset']*1000 - new Date()) + 7000;
debug('rate limit reached, sleeping during', Math.ceil(sleep_duration/60000), 'minutes');
debug('rate limit reached, sleeping during', Math.ceil(self.sleep_duration/60000), 'minutes');
setTimeout(function() {
debug('rate limit reset, resuming extraction...');
params = preProcess(res.tuiter.params);
self.APIRequest(res.tuiter.endpoint, res.tuiter.params, res.tuiter.callback);
}, sleep_duration);
}, self.sleep_duration);
};

/*
Expand Down

0 comments on commit aea178f

Please sign in to comment.