From 4df379f90ce8a15c5c91701f44444c33e19e44c7 Mon Sep 17 00:00:00 2001 From: Corentin Chary Date: Tue, 11 Oct 2016 13:57:53 +0200 Subject: [PATCH] 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. --- public/app/features/dashboard/timeSrv.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/app/features/dashboard/timeSrv.js b/public/app/features/dashboard/timeSrv.js index ac163e4ad09..f83c2bf0517 100644 --- a/public/app/features/dashboard/timeSrv.js +++ b/public/app/features/dashboard/timeSrv.js @@ -77,12 +77,11 @@ define([ this.setAutoRefresh = function (interval) { this.dashboard.refresh = interval; if (interval) { - var _i = kbn.interval_to_ms(interval); - var wait_ms = _i - (Date.now() % _i); + var interval_ms = kbn.interval_to_ms(interval); $timeout(function () { - self.start_scheduled_refresh(_i); + self.start_scheduled_refresh(interval_ms); self.refreshDashboard(); - }, wait_ms); + }, interval_ms); } else { this.cancel_scheduled_refresh(); }