parse_counters: cache previous reply and skip processing of unchanged rows
This commit is contained in:
parent
e1f7b05b52
commit
a4e04c498f
|
@ -6,11 +6,12 @@ var _viewfeed_last = 0;
|
||||||
var _viewfeed_timeout = false;
|
var _viewfeed_timeout = false;
|
||||||
|
|
||||||
var counters_last_request = 0;
|
var counters_last_request = 0;
|
||||||
|
var _counters_prev = [];
|
||||||
|
|
||||||
function viewCategory(cat) {
|
/*function viewCategory(cat) {
|
||||||
viewfeed({feed: cat, is_cat: true});
|
viewfeed({feed: cat, is_cat: true});
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
function loadMoreHeadlines() {
|
function loadMoreHeadlines() {
|
||||||
try {
|
try {
|
||||||
|
@ -253,10 +254,18 @@ function request_counters(force) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parse_counters(elems, scheduled_call) {
|
function parse_counters(elems) {
|
||||||
try {
|
try {
|
||||||
for (var l = 0; l < elems.length; l++) {
|
for (var l = 0; l < elems.length; l++) {
|
||||||
|
|
||||||
|
if (_counters_prev[l] &&
|
||||||
|
_counters_prev[l].id == elems[l].id &&
|
||||||
|
_counters_prev[l].updated == elems[l].updated &&
|
||||||
|
_counters_prev[l].counter == elems[l].counter) {
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var id = elems[l].id;
|
var id = elems[l].id;
|
||||||
var kind = elems[l].kind;
|
var kind = elems[l].kind;
|
||||||
var ctr = parseInt(elems[l].counter);
|
var ctr = parseInt(elems[l].counter);
|
||||||
|
@ -300,6 +309,8 @@ function parse_counters(elems, scheduled_call) {
|
||||||
|
|
||||||
hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
|
hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
|
||||||
|
|
||||||
|
_counters_prev = elems;
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("parse_counters", e);
|
exception_error("parse_counters", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue