implement sequence numbers for counter rpc requests
This commit is contained in:
parent
08e49bb91d
commit
6237ea0537
|
@ -607,7 +607,7 @@ function request_counters_real() {
|
|||
|
||||
console.log("requesting counters...");
|
||||
|
||||
var query = "?op=rpc&subop=getAllCounters";
|
||||
var query = "?op=rpc&subop=getAllCounters&seq=" + next_seq();
|
||||
|
||||
if (tagsAreDisplayed()) {
|
||||
query = query + "&omode=tl";
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
function handle_rpc_request($link) {
|
||||
|
||||
$subop = $_REQUEST["subop"];
|
||||
$seq = (int) $_REQUEST["seq"];
|
||||
|
||||
if ($subop == "setprofile") {
|
||||
$id = db_escape_string($_REQUEST["id"]);
|
||||
|
@ -285,6 +286,9 @@
|
|||
|
||||
print "<rpc-reply>";
|
||||
|
||||
if ($seq)
|
||||
print "<seq>$seq</seq>";
|
||||
|
||||
if ($last_article_id != getLastArticleId($link)) {
|
||||
print "<counters><![CDATA[";
|
||||
$omode = $_REQUEST["omode"];
|
||||
|
|
24
tt-rss.js
24
tt-rss.js
|
@ -15,6 +15,17 @@ var feedlist_sortable_enabled = false;
|
|||
var _force_scheduled_update = false;
|
||||
var last_scheduled_update = false;
|
||||
|
||||
var _rpc_seq = 0;
|
||||
|
||||
function next_seq() {
|
||||
_rpc_seq += 1;
|
||||
return _rpc_seq;
|
||||
}
|
||||
|
||||
function get_seq() {
|
||||
return _rpc_seq;
|
||||
}
|
||||
|
||||
function activeFeedIsCat() {
|
||||
return _active_feed_is_cat;
|
||||
}
|
||||
|
@ -167,7 +178,7 @@ function timeout() {
|
|||
|
||||
window.clearTimeout(counter_timeout_id);
|
||||
|
||||
var query_str = "?op=rpc&subop=getAllCounters";
|
||||
var query_str = "?op=rpc&subop=getAllCounters&seq=" + next_seq();
|
||||
|
||||
var omode;
|
||||
|
||||
|
@ -1263,6 +1274,17 @@ function handle_rpc_reply(transport, scheduled_call) {
|
|||
|
||||
if (!transport_error_check(transport)) return false;
|
||||
|
||||
var seq = transport.responseXML.getElementsByTagName("seq")[0];
|
||||
|
||||
if (seq) {
|
||||
seq = seq.firstChild.nodeValue;
|
||||
|
||||
if (get_seq() != seq) {
|
||||
//console.log("[handle_rpc_reply] sequence mismatch: " + seq);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
var message = transport.responseXML.getElementsByTagName("message")[0];
|
||||
|
||||
if (message) {
|
||||
|
|
Loading…
Reference in New Issue