WebUI: avoid queuing up requests

`setInterval()` will always fire a new timeout regardless previous `updateRssFeedList()` has
completed or not. This patch will now wait for previous request to complete before another
timeout.
This commit is contained in:
Chocobo1 2024-07-23 16:34:55 +08:00
parent 69a829dfb0
commit 6b52a04ff1
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C

View File

@ -180,7 +180,7 @@
const serverSyncRssDataInterval = 1500;
let feedData = {};
let pathByFeedId = new Map();
let feedRefreshTimer;
let feedRefreshTimer = -1;
const rssFeedTable = new window.qBittorrent.DynamicTable.RssFeedTable();
const rssArticleTable = new window.qBittorrent.DynamicTable.RssArticleTable();
@ -293,11 +293,15 @@
};
const unload = () => {
clearInterval(feedRefreshTimer);
clearTimeout(feedRefreshTimer);
feedRefreshTimer = -1;
};
const load = () => {
feedRefreshTimer = setInterval(updateRssFeedList, serverSyncRssDataInterval);
feedRefreshTimer = setTimeout(() => {
updateRssFeedList();
load();
}, serverSyncRssDataInterval);
};
const addRSSFeed = () => {