From b9a63fa15c11470ab2a71b723fd45bd1d5448e34 Mon Sep 17 00:00:00 2001 From: anekos Date: Mon, 29 Nov 2010 20:18:34 +0900 Subject: nyaaps --- twittperator.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'twittperator.js') diff --git a/twittperator.js b/twittperator.js index d1511b8..2ea49b9 100644 --- a/twittperator.js +++ b/twittperator.js @@ -28,7 +28,7 @@ let PLUGIN_INFO = Twittperator Twitter Client using OAuth and Streaming API OAuth/StreamingAPI対応Twitterクライアント - 1.9.4 + 1.9.5 2.3 2.4 teramako @@ -1342,6 +1342,18 @@ let PLUGIN_INFO = let restartCount = 0; let lastParams; let listeners = []; + let retryTimer; + + function clearRetryTimer() { + if (retryTimer) + clearTimeout(retryTimer); + retryTimer = null; + } + + function updateRetryTimer(restartFunc) { + clearRetryTimer(); + retryTimer = setTimeout(restartFunc, 60 * 1000); + } function restart() { stop(); @@ -1354,6 +1366,7 @@ let PLUGIN_INFO = } function stop() { + clearRetryTimer(); if (!connection) return; connection.cancel(); @@ -1381,6 +1394,7 @@ let PLUGIN_INFO = let onReceive = function(data) { try { + updateRetryTimer(restart); let lines = data.split(/\r\n|[\r\n]/); if (lines.length >= 2) { lines[0] = buf + lines[0]; -- cgit v1.2.3