From 7588bfde39d101d59fcb67540f9809ab5dc13e72 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 23 Jul 2021 16:53:22 +0100 Subject: [PATCH] Adjusting how redis modules are loaded, making sure client is always set, before init. --- packages/server/src/utilities/redis.js | 6 ++++-- packages/worker/src/utilities/redis.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/server/src/utilities/redis.js b/packages/server/src/utilities/redis.js index e1fa632003..6f1cf46606 100644 --- a/packages/server/src/utilities/redis.js +++ b/packages/server/src/utilities/redis.js @@ -7,8 +7,10 @@ let devAppClient, debounceClient // we init this as we want to keep the connection open all the time // reduces the performance hit exports.init = async () => { - devAppClient = await new Client(utils.Databases.DEV_LOCKS).init() - debounceClient = await new Client(utils.Databases.DEBOUNCE).init() + devAppClient = new Client(utils.Databases.DEV_LOCKS) + debounceClient = new Client(utils.Databases.DEBOUNCE) + await devAppClient.init() + await debounceClient.init() } exports.shutdown = async () => { diff --git a/packages/worker/src/utilities/redis.js b/packages/worker/src/utilities/redis.js index 6e55795de1..6dd4491bc4 100644 --- a/packages/worker/src/utilities/redis.js +++ b/packages/worker/src/utilities/redis.js @@ -43,8 +43,10 @@ async function getACode(db, code, deleteCode = true) { } exports.init = async () => { - pwResetClient = await new Client(utils.Databases.PW_RESETS).init() - invitationClient = await new Client(utils.Databases.INVITATIONS).init() + pwResetClient = new Client(utils.Databases.PW_RESETS) + invitationClient = new Client(utils.Databases.INVITATIONS) + await pwResetClient.init() + await invitationClient.init() } /**