Permalink
Browse files

Bugfixes with twitter reconnect

  • Loading branch information...
1 parent c477adf commit 76e8811e1f24f9243c4742f9a82c7fedb19c2271 @dmongeau dmongeau committed Dec 10, 2012
Showing with 9 additions and 3 deletions.
  1. +8 −2 lib/processor.js
  2. +1 −1 package.json
View
@@ -104,6 +104,8 @@ TwitterProcessor.prototype._startStream = function() {
//On new tweet
stream.on('data', function (tweet) {
+
+ self._retriesCount = 1;
//Add tweet to queue
if(typeof(tweet.text) != 'undefined') {
@@ -118,15 +120,19 @@ TwitterProcessor.prototype._startStream = function() {
console.log('Twitter error',arguments);
}
try {
- self._retriesCount = self._retriesCount * 2;
+ if(self._retriesCount < 300) {
+ self._retriesCount = self._retriesCount * 2;
+ }
stream.destroy();
} catch(e){}
});
//On stream end
stream.on('end', function (response) {
+ if(self.options.debug) {
+ console.log('Twitter end');
+ }
try {
- self._retriesCount = 1;
stream.destroy();
} catch(e){}
});
View
@@ -13,7 +13,7 @@
"David Mongeau-Petitpas <dmp@atelierfolklore.ca>",
"François Côté <fc@atelierfolklore.ca>"
],
- "version": "0.0.9-2",
+ "version": "0.0.9-4",
"dependencies": {
"ntwitter" : "0.5.x",
"queueleuleu" : "0.x"

0 comments on commit 76e8811

Please sign in to comment.