Commit 4df379f9 by Corentin Chary Committed by Torkel Ödegaard

Do not align refresh time (#6178)

When you have a lot of dashboards, all of them
end up refreshing their dashboards at the exact
same time, which isn't particulary good for your
TSDB backend.
parent f7124f16
...@@ -77,12 +77,11 @@ define([ ...@@ -77,12 +77,11 @@ define([
this.setAutoRefresh = function (interval) { this.setAutoRefresh = function (interval) {
this.dashboard.refresh = interval; this.dashboard.refresh = interval;
if (interval) { if (interval) {
var _i = kbn.interval_to_ms(interval); var interval_ms = kbn.interval_to_ms(interval);
var wait_ms = _i - (Date.now() % _i);
$timeout(function () { $timeout(function () {
self.start_scheduled_refresh(_i); self.start_scheduled_refresh(interval_ms);
self.refreshDashboard(); self.refreshDashboard();
}, wait_ms); }, interval_ms);
} else { } else {
this.cancel_scheduled_refresh(); this.cancel_scheduled_refresh();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment