mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 15:55:56 +00:00
try to calculate counters conditionally based on feed ids
This commit is contained in:
@@ -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)
|
||||
|
||||
10
js/Feeds.js
10
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();
|
||||
});
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user