mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 10:46:04 +03:00
WebUI: clear timer variable properly
In JS the timer handle pool is reused and therefore require careful handling of it.
This commit is contained in:
parent
7131d1bd6b
commit
bf7e1516d5
7 changed files with 18 additions and 8 deletions
|
@ -705,7 +705,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
};
|
||||
})();
|
||||
|
||||
let syncMainDataTimeoutID;
|
||||
let syncMainDataTimeoutID = -1;
|
||||
let syncRequestInProgress = false;
|
||||
const syncMainData = function() {
|
||||
const url = new URI("api/v2/sync/maindata");
|
||||
|
@ -889,6 +889,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
return;
|
||||
|
||||
clearTimeout(syncMainDataTimeoutID);
|
||||
syncMainDataTimeoutID = -1;
|
||||
|
||||
if (window.qBittorrent.Client.isStopped())
|
||||
return;
|
||||
|
|
|
@ -306,6 +306,8 @@ window.qBittorrent.PropFiles ??= (() => {
|
|||
return;
|
||||
|
||||
clearTimeout(loadTorrentFilesDataTimer);
|
||||
loadTorrentFilesDataTimer = -1;
|
||||
|
||||
new Request({
|
||||
url: "api/v2/torrents/filePrio",
|
||||
method: "post",
|
||||
|
@ -331,7 +333,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
|||
torrentFilesTable.updateTable(false);
|
||||
};
|
||||
|
||||
let loadTorrentFilesDataTimer;
|
||||
let loadTorrentFilesDataTimer = -1;
|
||||
const loadTorrentFilesData = function() {
|
||||
if ($("prop_files").hasClass("invisible")
|
||||
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
||||
|
@ -378,6 +380,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
|||
|
||||
const updateData = function() {
|
||||
clearTimeout(loadTorrentFilesDataTimer);
|
||||
loadTorrentFilesDataTimer = -1;
|
||||
loadTorrentFilesData();
|
||||
};
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ window.qBittorrent.PropGeneral ??= (() => {
|
|||
piecesBar.clear();
|
||||
};
|
||||
|
||||
let loadTorrentDataTimer;
|
||||
let loadTorrentDataTimer = -1;
|
||||
const loadTorrentData = function() {
|
||||
if ($("prop_general").hasClass("invisible")
|
||||
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
||||
|
@ -250,6 +250,7 @@ window.qBittorrent.PropGeneral ??= (() => {
|
|||
|
||||
const updateData = function() {
|
||||
clearTimeout(loadTorrentDataTimer);
|
||||
loadTorrentDataTimer = -1;
|
||||
loadTorrentData();
|
||||
};
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ window.qBittorrent.PropPeers ??= (() => {
|
|||
};
|
||||
|
||||
const torrentPeersTable = new window.qBittorrent.DynamicTable.TorrentPeersTable();
|
||||
let loadTorrentPeersTimer;
|
||||
let loadTorrentPeersTimer = -1;
|
||||
let syncTorrentPeersLastResponseId = 0;
|
||||
let show_flags = true;
|
||||
|
||||
|
@ -109,6 +109,7 @@ window.qBittorrent.PropPeers ??= (() => {
|
|||
|
||||
const updateData = function() {
|
||||
clearTimeout(loadTorrentPeersTimer);
|
||||
loadTorrentPeersTimer = -1;
|
||||
loadTorrentPeersData();
|
||||
};
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ window.qBittorrent.PropTrackers ??= (() => {
|
|||
let current_hash = "";
|
||||
|
||||
const torrentTrackersTable = new window.qBittorrent.DynamicTable.TorrentTrackersTable();
|
||||
let loadTrackersDataTimer;
|
||||
let loadTrackersDataTimer = -1;
|
||||
|
||||
const loadTrackersData = function() {
|
||||
if ($("prop_trackers").hasClass("invisible")
|
||||
|
@ -119,6 +119,7 @@ window.qBittorrent.PropTrackers ??= (() => {
|
|||
|
||||
const updateData = function() {
|
||||
clearTimeout(loadTrackersDataTimer);
|
||||
loadTrackersDataTimer = -1;
|
||||
loadTrackersData();
|
||||
};
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
|||
|
||||
let current_hash = "";
|
||||
|
||||
let loadWebSeedsDataTimer;
|
||||
let loadWebSeedsDataTimer = -1;
|
||||
const loadWebSeedsData = function() {
|
||||
if ($("prop_webseeds").hasClass("invisible")
|
||||
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
||||
|
@ -138,6 +138,7 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
|||
|
||||
const updateData = function() {
|
||||
clearTimeout(loadWebSeedsDataTimer);
|
||||
loadWebSeedsDataTimer = -1;
|
||||
loadWebSeedsData();
|
||||
};
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ window.qBittorrent.Search ??= (() => {
|
|||
};
|
||||
|
||||
const searchTabIdPrefix = "Search-";
|
||||
let loadSearchPluginsTimer;
|
||||
let loadSearchPluginsTimer = -1;
|
||||
const searchPlugins = [];
|
||||
let prevSearchPluginsResponse;
|
||||
let selectedCategory = "QBT_TR(All categories)QBT_TR[CONTEXT=SearchEngineWidget]";
|
||||
|
@ -207,7 +207,7 @@ window.qBittorrent.Search ??= (() => {
|
|||
rowId: 0,
|
||||
selectedRowIds: [],
|
||||
running: true,
|
||||
loadResultsTimer: null,
|
||||
loadResultsTimer: -1,
|
||||
sort: { column: searchResultsTable.sortedColumn, reverse: searchResultsTable.reverseSort },
|
||||
});
|
||||
updateSearchResultsData(searchId);
|
||||
|
@ -507,6 +507,7 @@ window.qBittorrent.Search ??= (() => {
|
|||
},
|
||||
onClose: function() {
|
||||
clearTimeout(loadSearchPluginsTimer);
|
||||
loadSearchPluginsTimer = -1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -569,6 +570,7 @@ window.qBittorrent.Search ??= (() => {
|
|||
if (state) {
|
||||
state.running = false;
|
||||
clearTimeout(state.loadResultsTimer);
|
||||
state.loadResultsTimer = -1;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue