From d53cdaf815c86bf66a5577f575f76831679ed4f2 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 12 Dec 2018 20:06:44 +0300 Subject: requestCounters: remove cooldown --- js/AppBase.js | 1 - js/Feeds.js | 25 ++++--------------------- 2 files changed, 4 insertions(+), 22 deletions(-) (limited to 'js') diff --git a/js/AppBase.js b/js/AppBase.js index 6fc4f8bff..a9efbfecb 100644 --- a/js/AppBase.js +++ b/js/AppBase.js @@ -218,7 +218,6 @@ define(["dojo/_base/declare"], function (declare) { if (message == "UPDATE_COUNTERS") { console.log("need to refresh counters..."); - App.setInitParam("last_article_id", -1); Feeds.requestCounters(true); } diff --git a/js/Feeds.js b/js/Feeds.js index 94b72c731..44d48d6c7 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -120,27 +120,10 @@ define(["dojo/_base/declare"], function (declare) { this._search_query = ""; this.reloadCurrent(); }, - requestCounters: function(force) { - const date = new Date(); - 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); - }); - - } else { - console.log("request_counters: rate limit reached: " + (timestamp - this.counters_last_request)); - } + requestCounters: function() { + xhrPost("backend.php", {op: "rpc", method: "getAllCounters", seq: App.next_seq()}, (transport) => { + App.handleRpcJson(transport); + }); }, reload: function() { try { -- cgit v1.2.3