From a120d6648ffe9103093022aa9c4840dbf25e993d Mon Sep 17 00:00:00 2001 From: Timothy Sullivan Date: Mon, 3 Dec 2018 14:25:47 -0700 Subject: [PATCH 1/2] [Telemetry] Remove initial delay to check and send --- .../xpack_main/public/hacks/telemetry.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/x-pack/plugins/xpack_main/public/hacks/telemetry.js b/x-pack/plugins/xpack_main/public/hacks/telemetry.js index 4b03f1c951118..03da923ee7fcb 100644 --- a/x-pack/plugins/xpack_main/public/hacks/telemetry.js +++ b/x-pack/plugins/xpack_main/public/hacks/telemetry.js @@ -92,17 +92,13 @@ export class Telemetry { * Public method */ start() { - // delay the initial report to allow the user some time to read the opt-out message - let hasWaited = false; - - // continuously check if it's due time for a report - window.setInterval(() => { - if (hasWaited) { - // throw away the return data - this._sendIfDue(); - } - hasWaited = true; - }, 60000); + const checkAndSend = () => { + // check immediately + this._sendIfDue(); + // check again every 1 minute + window.setTimeout(() => checkAndSend(), 60000); + }; + checkAndSend(); } } // end class From d0ec3e6f6c12c522e2b13092a2fc90ffbe3564b0 Mon Sep 17 00:00:00 2001 From: Timothy Sullivan Date: Mon, 3 Dec 2018 17:05:29 -0700 Subject: [PATCH 2/2] do not fire immediately --- x-pack/plugins/xpack_main/public/hacks/telemetry.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/x-pack/plugins/xpack_main/public/hacks/telemetry.js b/x-pack/plugins/xpack_main/public/hacks/telemetry.js index 03da923ee7fcb..46bd909628a0a 100644 --- a/x-pack/plugins/xpack_main/public/hacks/telemetry.js +++ b/x-pack/plugins/xpack_main/public/hacks/telemetry.js @@ -92,13 +92,7 @@ export class Telemetry { * Public method */ start() { - const checkAndSend = () => { - // check immediately - this._sendIfDue(); - // check again every 1 minute - window.setTimeout(() => checkAndSend(), 60000); - }; - checkAndSend(); + window.setInterval(() => this._sendIfDue(), 60000); } } // end class