From fd45ac86ab5b5997178997999a4a787157cb1ad6 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 25 Jun 2021 15:32:59 +0100 Subject: [PATCH] Fixing issue with Redis which was causing CPU peaking if couldn't connect. --- packages/auth/src/redis/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/auth/src/redis/index.js b/packages/auth/src/redis/index.js index 7d9e9ad637..e20255bfd3 100644 --- a/packages/auth/src/redis/index.js +++ b/packages/auth/src/redis/index.js @@ -18,6 +18,8 @@ function connectionError(timeout, err) { if (CLOSED) { return } + CLIENT.end() + CLOSED = true // always clear this on error clearTimeout(timeout) CONNECTED = false @@ -41,7 +43,7 @@ function init() { // start the timer - only allowed 5 seconds to connect timeout = setTimeout(() => { if (!CONNECTED) { - connectionError(timeout) + connectionError(timeout, "Did not successfully connect in timeout") } }, STARTUP_TIMEOUT_MS)