From ab5b93e10d83429e2a21e125f758eb4da154d55b Mon Sep 17 00:00:00 2001 From: vikasrohit Date: Fri, 17 Jan 2020 14:41:16 +0530 Subject: [PATCH] Avoid reusing the global variable for client It might be causing the caching of m2m token --- src/services/messageService.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/services/messageService.js b/src/services/messageService.js index c596dddf..f1ffc384 100644 --- a/src/services/messageService.js +++ b/src/services/messageService.js @@ -7,7 +7,6 @@ const tcCoreLibAuth = require('tc-core-library-js').auth; const m2m = tcCoreLibAuth.m2m(config); -let client = null; /** * Get Http client to bus api @@ -15,7 +14,7 @@ let client = null; * @return {Object} Http Client to bus api */ async function getClient(logger) { - if (client) return client; + let client = null; const msgApiUrl = config.get('messageApiUrl'); try { const token = await m2m.getMachineToken(config.AUTH0_CLIENT_ID, config.AUTH0_CLIENT_SECRET);