From cebeab02f961d06c23e450b05458904ab813d09b Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Fri, 30 Sep 2016 21:21:44 +0100 Subject: [PATCH] toggle twitter limit rate status back if not limited anymore --- social/twitter/27-twitter.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/social/twitter/27-twitter.js b/social/twitter/27-twitter.js index f2388ac6..5f009ac6 100644 --- a/social/twitter/27-twitter.js +++ b/social/twitter/27-twitter.js @@ -219,6 +219,7 @@ module.exports = function(RED) { stream.on('limit', function(tweet) { //node.status({fill:"grey", shape:"dot", text:RED._("twitter.errors.limitrate")}); node.status({fill:"grey", shape:"dot", text:(tags||" ")}); + node.tout2 = setTimeout(function() { node.status({fill:"green", shape:"dot", text:(tags||" ")}); },10000); }); stream.on('error', function(tweet,rc) { //console.log("ERRO",rc,tweet); @@ -268,9 +269,8 @@ module.exports = function(RED) { if (this.user === "false") { node.on("input", function(msg) { if (this.tags === '') { - if (node.tout) { - clearTimeout(node.tout); - } + if (node.tout) { clearTimeout(node.tout); } + if (node.tout2) { clearTimeout(node.tout2); } if (this.stream) { this.restart = false; node.stream.removeAllListeners(); @@ -318,6 +318,7 @@ module.exports = function(RED) { this.on('close', function() { if (node.tout) { clearTimeout(node.tout); } + if (node.tout2) { clearTimeout(node.tout2); } if (this.stream) { this.restart = false; node.stream.removeAllListeners();