From c3b8b6a2a19102f958a9e4c2c007d83abe52ef9b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 16 Dec 2018 12:43:53 +0300 Subject: also prevent multiple requests --- js/Headlines.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'js/Headlines.js') diff --git a/js/Headlines.js b/js/Headlines.js index 19ab69d16..783067f30 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -4,6 +4,7 @@ define(["dojo/_base/declare"], function (declare) { Headlines = { vgroup_last_feed: undefined, _headlines_scroll_timeout: 0, + _observer_counters_timeout: 0, headlines: [], current_first_id: 0, row_observer: new MutationObserver((mutations) => { @@ -141,7 +142,9 @@ define(["dojo/_base/declare"], function (declare) { if (promises.length > 0) Promise.all([promises]).then(() => { - setTimeout(() => { + window.clearTimeout(this._observer_counters_timeout); + + this._observer_counters_timeout = setTimeout(() => { Feeds.requestCounters(true); }, 1000); }); -- cgit v1.2.3