diff options
author | Andrew Dolgov <[email protected]> | 2021-02-24 09:47:26 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-24 09:47:26 +0300 |
commit | d6203bf3508ba77e3943ddc412eb562edb327f22 (patch) | |
tree | eb0e56ff62add4705c200903d559fa7d3f412acb /js | |
parent | a42e8aad97b66fd4964263e37a1b40164e495b4c (diff) |
try to calculate counters conditionally based on feed ids
Diffstat (limited to 'js')
-rw-r--r-- | js/App.js | 4 | ||||
-rw-r--r-- | js/Feeds.js | 10 | ||||
-rwxr-xr-x | js/Headlines.js | 18 |
3 files changed, 16 insertions, 16 deletions
@@ -421,8 +421,8 @@ const App = { // not in preferences if (typeof Feeds != "undefined") { if (message == "UPDATE_COUNTERS") { - console.log("need to refresh counters..."); - Feeds.requestCounters(true); + console.log("need to refresh counters for", reply.feeds); + Feeds.requestCounters(reply.feeds); } if (counters) diff --git a/js/Feeds.js b/js/Feeds.js index a8f08e623..e40d31087 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -133,8 +133,8 @@ const Feeds = { this._search_query = ""; this.reloadCurrent(); }, - requestCounters: function() { - xhr.json("backend.php", {op: "rpc", method: "getAllCounters", seq: App.next_seq()}, () => { + requestCounters: function(feed_ids = null) { + xhr.json("backend.php", {op: "rpc", method: "getAllCounters", feed_ids: feed_ids, seq: App.next_seq()}, () => { // }); }, @@ -264,10 +264,10 @@ const Feeds = { // bw_limit disables timeout() so we request initial counters separately if (App.getInitParam("bw_limit")) { - this.requestCounters(true); + this.requestCounters(); } else { setTimeout(() => { - this.requestCounters(true); + this.requestCounters(); setInterval(() => { this.requestCounters(); }, 60 * 1000) }, 250); } @@ -396,7 +396,7 @@ const Feeds = { Notify.progress("Marking all feeds as read..."); xhr.post("backend.php", {op: "feeds", method: "catchupAll"}, () => { - this.requestCounters(true); + this.requestCounters(); this.reloadCurrent(); }); diff --git a/js/Headlines.js b/js/Headlines.js index abb96d4ce..1ba52a6b8 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -7,7 +7,7 @@ const Headlines = { vgroup_last_feed: undefined, _headlines_scroll_timeout: 0, - _observer_counters_timeout: 0, + //_observer_counters_timeout: 0, headlines: [], current_first_id: 0, _scroll_reset_timeout: false, @@ -149,38 +149,38 @@ const Headlines = { const promises = []; if (ops.tmark.length != 0) - promises.push(xhr.post("backend.php", + promises.push(xhr.json("backend.php", {op: "rpc", method: "markSelected", ids: ops.tmark.toString(), cmode: 2})); if (ops.tpub.length != 0) - promises.push(xhr.post("backend.php", + promises.push(xhr.json("backend.php", {op: "rpc", method: "publishSelected", ids: ops.tpub.toString(), cmode: 2})); if (ops.read.length != 0) - promises.push(xhr.post("backend.php", + promises.push(xhr.json("backend.php", {op: "rpc", method: "catchupSelected", ids: ops.read.toString(), cmode: 0})); if (ops.unread.length != 0) - promises.push(xhr.post("backend.php", + promises.push(xhr.json("backend.php", {op: "rpc", method: "catchupSelected", ids: ops.unread.toString(), cmode: 1})); const scores = Object.keys(ops.rescore); if (scores.length != 0) { scores.forEach((score) => { - promises.push(xhr.post("backend.php", + promises.push(xhr.json("backend.php", {op: "article", method: "setScore", id: ops.rescore[score].toString(), score: score})); }); } - if (promises.length > 0) + /*if (promises.length > 0) Promise.all([promises]).then(() => { window.clearTimeout(this._observer_counters_timeout); this._observer_counters_timeout = setTimeout(() => { - Feeds.requestCounters(true); + Feeds.requestCounters(); }, 1000); - }); + });*/ }, click: function (event, id, in_body) { |