From 1f9d05519e42b73fc574120a47dfacff64de460c Mon Sep 17 00:00:00 2001 From: antiwinter Date: Fri, 29 Sep 2017 16:54:50 +0800 Subject: [PATCH] 1. fix the repeatedly alerts when the token or URL is incorrect 2. fix a bug that update will not be called immediately after new configurations set --- js/services/rpc/rpc.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/js/services/rpc/rpc.js b/js/services/rpc/rpc.js index 8b57c3b..9cba9c5 100644 --- a/js/services/rpc/rpc.js +++ b/js/services/rpc/rpc.js @@ -107,7 +107,7 @@ function(syscall, globalTimeout, alerts, utils, rootScope, uri, authconf, filter alerts.addAlert('' + filter('translate')('Oh Snap!') + ' ' + filter('translate')('Could not connect to the aria2 RPC server. Will retry in 10 secs. You might want to check the connection settings by going to Settings > Connection Settings') , 'error'); - timeout = setTimeout(update, globalTimeout); +// timeout = setTimeout(update, globalTimeout); } }; @@ -189,10 +189,9 @@ function(syscall, globalTimeout, alerts, utils, rootScope, uri, authconf, filter else configurations = [conf]; - if (timeout) { + if (timeout) clearTimeout(timeout); - timeout = setTimeout(update, 0); - } + timeout = setTimeout(update, 0); }, // get current configuration being used