Browse Source

WebUI: Ensure that no concurrent timers exist

adaptive-webui-19844
Gabriele 10 years ago
parent
commit
7a58a3fe43
  1. 4
      src/webui/www/public/scripts/client.js
  2. 3
      src/webui/www/public/scripts/prop-files.js
  3. 3
      src/webui/www/public/scripts/prop-general.js
  4. 3
      src/webui/www/public/scripts/prop-trackers.js

4
src/webui/www/public/scripts/client.js

@ -56,6 +56,7 @@ var loadTorrentsInfo = function () {
method : 'get', method : 'get',
onFailure : function () { onFailure : function () {
$('error_div').set('html', '_(qBittorrent client is not reachable)'); $('error_div').set('html', '_(qBittorrent client is not reachable)');
clearTimeout(loadTorrentsInfoTimer);
loadTorrentsInfoTimer = loadTorrentsInfo.delay(2000); loadTorrentsInfoTimer = loadTorrentsInfo.delay(2000);
}, },
onSuccess : function (events) { onSuccess : function (events) {
@ -138,6 +139,7 @@ var loadTorrentsInfo = function () {
myTable.altRow(); myTable.altRow();
} }
clearTimeout(loadTorrentsInfoTimer);
loadTorrentsInfoTimer = loadTorrentsInfo.delay(1500); loadTorrentsInfoTimer = loadTorrentsInfo.delay(1500);
} }
}).send(); }).send();
@ -233,6 +235,7 @@ window.addEvent('load', function () {
method : 'get', method : 'get',
onFailure : function () { onFailure : function () {
$('error_div').set('html', '_(qBittorrent client is not reachable)'); $('error_div').set('html', '_(qBittorrent client is not reachable)');
clearTimeout(loadTransferInfoTimer);
loadTransferInfoTimer = loadTransferInfo.delay(4000); loadTransferInfoTimer = loadTransferInfo.delay(4000);
}, },
onSuccess : function (info) { onSuccess : function (info) {
@ -247,6 +250,7 @@ window.addEvent('load', function () {
document.title = "_(D:%1 U:%2)".replace("%1", friendlyUnit(info.dl_info_speed, true)).replace("%2", friendlyUnit(info.up_info_speed, true)); document.title = "_(D:%1 U:%2)".replace("%1", friendlyUnit(info.dl_info_speed, true)).replace("%2", friendlyUnit(info.up_info_speed, true));
else else
document.title = "_(qBittorrent web User Interface)"; document.title = "_(qBittorrent web User Interface)";
clearTimeout(loadTransferInfoTimer);
loadTransferInfoTimer = loadTransferInfo.delay(3000); loadTransferInfoTimer = loadTransferInfo.delay(3000);
} }
} }

3
src/webui/www/public/scripts/prop-files.js

@ -281,6 +281,7 @@ var loadTorrentFilesData = function() {
var new_hash = myTable.getCurrentTorrentHash(); var new_hash = myTable.getCurrentTorrentHash();
if (new_hash == "") { if (new_hash == "") {
fTable.removeAllRows(); fTable.removeAllRows();
clearTimeout(loadTorrentFilesDataTimer);
loadTorrentFilesDataTimer = loadTorrentFilesData.delay(5000); loadTorrentFilesDataTimer = loadTorrentFilesData.delay(5000);
return; return;
} }
@ -295,6 +296,7 @@ var loadTorrentFilesData = function() {
method: 'get', method: 'get',
onFailure: function() { onFailure: function() {
$('error_div').set('html', '_(qBittorrent client is not reachable)'); $('error_div').set('html', '_(qBittorrent client is not reachable)');
clearTimeout(loadTorrentFilesDataTimer);
loadTorrentFilesDataTimer = loadTorrentFilesData.delay(10000); loadTorrentFilesDataTimer = loadTorrentFilesData.delay(10000);
}, },
onSuccess: function(files) { onSuccess: function(files) {
@ -334,6 +336,7 @@ var loadTorrentFilesData = function() {
else { else {
fTable.removeAllRows(); fTable.removeAllRows();
} }
clearTimeout(loadTorrentFilesDataTimer);
loadTorrentFilesDataTimer = loadTorrentFilesData.delay(5000); loadTorrentFilesDataTimer = loadTorrentFilesData.delay(5000);
} }
}).send(); }).send();

3
src/webui/www/public/scripts/prop-general.js

@ -23,6 +23,7 @@ var loadTorrentData = function() {
var current_hash = myTable.getCurrentTorrentHash(); var current_hash = myTable.getCurrentTorrentHash();
if (current_hash == "") { if (current_hash == "") {
clearData(); clearData();
clearTimeout(loadTorrentDataTimer);
loadTorrentDataTimer = loadTorrentData.delay(5000); loadTorrentDataTimer = loadTorrentData.delay(5000);
return; return;
} }
@ -35,6 +36,7 @@ var loadTorrentData = function() {
method: 'get', method: 'get',
onFailure: function() { onFailure: function() {
$('error_div').set('html', '_(qBittorrent client is not reachable)'); $('error_div').set('html', '_(qBittorrent client is not reachable)');
clearTimeout(loadTorrentDataTimer);
loadTorrentDataTimer = loadTorrentData.delay(10000); loadTorrentDataTimer = loadTorrentData.delay(10000);
}, },
onSuccess: function(data) { onSuccess: function(data) {
@ -72,6 +74,7 @@ var loadTorrentData = function() {
else { else {
clearData(); clearData();
} }
clearTimeout(loadTorrentDataTimer);
loadTorrentDataTimer = loadTorrentData.delay(5000); loadTorrentDataTimer = loadTorrentData.delay(5000);
} }
}).send(); }).send();

3
src/webui/www/public/scripts/prop-trackers.js

@ -61,6 +61,7 @@ var loadTrackersData = function() {
var new_hash = myTable.getCurrentTorrentHash(); var new_hash = myTable.getCurrentTorrentHash();
if (new_hash == "") { if (new_hash == "") {
tTable.removeAllRows(); tTable.removeAllRows();
clearTimeout(loadTrackersDataTimer);
loadTrackersDataTimer = loadTrackersData.delay(10000); loadTrackersDataTimer = loadTrackersData.delay(10000);
return; return;
} }
@ -75,6 +76,7 @@ var loadTrackersData = function() {
method: 'get', method: 'get',
onFailure: function() { onFailure: function() {
$('error_div').set('html', '_(qBittorrent client is not reachable)'); $('error_div').set('html', '_(qBittorrent client is not reachable)');
clearTimeout(loadTrackersDataTimer);
loadTrackersDataTimer = loadTrackersData.delay(20000); loadTrackersDataTimer = loadTrackersData.delay(20000);
}, },
onSuccess: function(trackers) { onSuccess: function(trackers) {
@ -94,6 +96,7 @@ var loadTrackersData = function() {
else { else {
tTable.removeAllRows(); tTable.removeAllRows();
} }
clearTimeout(loadTrackersDataTimer);
loadTrackersDataTimer = loadTrackersData.delay(10000); loadTrackersDataTimer = loadTrackersData.delay(10000);
} }
}).send(); }).send();

Loading…
Cancel
Save