From 53d409c034aaf7f4c8ab4d6401d0a60a614fcf26 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 2 Dec 2020 16:56:42 -0500 Subject: [PATCH] feedback --- x-pack/plugins/maps/server/plugin.ts | 4 +--- x-pack/plugins/maps/server/routes.js | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/maps/server/plugin.ts b/x-pack/plugins/maps/server/plugin.ts index 2a14473006320..f3241b79759a1 100644 --- a/x-pack/plugins/maps/server/plugin.ts +++ b/x-pack/plugins/maps/server/plugin.ts @@ -158,9 +158,7 @@ export class MapsPlugin implements Plugin { initRoutes( core.http.createRouter(), - () => { - return lastLicenseId; - }, + () => lastLicenseId, emsSettings, this.kibanaVersion, this._logger diff --git a/x-pack/plugins/maps/server/routes.js b/x-pack/plugins/maps/server/routes.js index 796f1fbc212b1..d98259540f5e4 100644 --- a/x-pack/plugins/maps/server/routes.js +++ b/x-pack/plugins/maps/server/routes.js @@ -58,7 +58,7 @@ export function initRoutes(router, getLicenseId, emsSettings, kbnVersion, logger function getEMSClient() { const currentLicenseId = getLicenseId(); - if (emsClient && lastLicenseId === currentLicenseId) { + if (emsClient && emsSettings.isEMSEnabled() && lastLicenseId === currentLicenseId) { return emsClient; } @@ -74,10 +74,10 @@ export function initRoutes(router, getLicenseId, emsSettings, kbnVersion, logger fetchFunction: fetch, }); emsClient.addQueryParams({ license: currentLicenseId }); + return emsClient; } else { - emsClient = EMPTY_EMS_CLIENT; + return EMPTY_EMS_CLIENT; } - return emsSettings.isEMSEnabled() ? emsClient : EMPTY_EMS_CLIENT; } router.get(