From 91fb3f2224cd9e228ad516ec4b232bd89cfa1839 Mon Sep 17 00:00:00 2001 From: Jesse White Date: Fri, 1 Sep 2017 01:19:51 -0400 Subject: [PATCH] fix: cancel the initial timer when changing the auto-refresh interval, fixes #9139 (#9140) --- public/app/features/dashboard/time_srv.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/public/app/features/dashboard/time_srv.ts b/public/app/features/dashboard/time_srv.ts index abde4152b63..2c16915b5aa 100644 --- a/public/app/features/dashboard/time_srv.ts +++ b/public/app/features/dashboard/time_srv.ts @@ -116,16 +116,14 @@ class TimeSrv { setAutoRefresh(interval) { this.dashboard.refresh = interval; + this.cancelNextRefresh(); if (interval) { var intervalMs = kbn.interval_to_ms(interval); - this.$timeout(() => { + this.refreshTimer = this.timer.register(this.$timeout(() => { this.startNextRefreshTimer(intervalMs); this.refreshDashboard(); - }, intervalMs); - - } else { - this.cancelNextRefresh(); + }, intervalMs)); } // update url