|
|
@ -120,27 +120,10 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
this._search_query = "";
|
|
|
|
this._search_query = "";
|
|
|
|
this.reloadCurrent();
|
|
|
|
this.reloadCurrent();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
requestCounters: function(force) {
|
|
|
|
requestCounters: function() {
|
|
|
|
const date = new Date();
|
|
|
|
xhrPost("backend.php", {op: "rpc", method: "getAllCounters", seq: App.next_seq()}, (transport) => {
|
|
|
|
const timestamp = Math.round(date.getTime() / 1000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (force || timestamp - this.counters_last_request > 5) {
|
|
|
|
|
|
|
|
console.log("scheduling request of counters...");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.counters_last_request = timestamp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let query = {op: "rpc", method: "getAllCounters", seq: App.next_seq()};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!force)
|
|
|
|
|
|
|
|
query.last_article_id = App.getInitParam("last_article_id");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", query, (transport) => {
|
|
|
|
|
|
|
|
App.handleRpcJson(transport);
|
|
|
|
App.handleRpcJson(transport);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
console.log("request_counters: rate limit reached: " + (timestamp - this.counters_last_request));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
reload: function() {
|
|
|
|
reload: function() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|