remove counters_last_request from globals

This commit is contained in:
Andrew Dolgov 2018-12-01 18:03:58 +03:00
parent 97df81d8d9
commit 18868fb7ac
1 changed files with 4 additions and 5 deletions

View File

@ -1,6 +1,5 @@
let counters_last_request = 0;
const Feeds = { const Feeds = {
counters_last_request: 0,
_active_feed_id: 0, _active_feed_id: 0,
_active_feed_is_cat: false, _active_feed_is_cat: false,
infscroll_in_progress: 0, infscroll_in_progress: 0,
@ -121,10 +120,10 @@ const Feeds = {
const date = new Date(); const date = new Date();
const timestamp = Math.round(date.getTime() / 1000); const timestamp = Math.round(date.getTime() / 1000);
if (force || timestamp - counters_last_request > 5) { if (force || timestamp - this.counters_last_request > 5) {
console.log("scheduling request of counters..."); console.log("scheduling request of counters...");
counters_last_request = timestamp; this.counters_last_request = timestamp;
let query = {op: "rpc", method: "getAllCounters", seq: Utils.next_seq()}; let query = {op: "rpc", method: "getAllCounters", seq: Utils.next_seq()};
@ -136,7 +135,7 @@ const Feeds = {
}); });
} else { } else {
console.log("request_counters: rate limit reached: " + (timestamp - counters_last_request)); console.log("request_counters: rate limit reached: " + (timestamp - this.counters_last_request));
} }
}, },
reload: function() { reload: function() {