From f383e0e433dfcaef9646d2686b649285bdae7b63 Mon Sep 17 00:00:00 2001 From: SquirrelDevelopper Date: Thu, 14 Nov 2024 17:22:30 +0100 Subject: [PATCH] Prevent duplicate cache setting for masterNodeUrl This change modifies the startup process to check if '_ssm_masterNodeUrl' is already set in the cache before attempting to set it again. This prevents redundant operations and ensures the value is only set if it does not already exist. --- server/src/core/startup/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/core/startup/index.ts b/server/src/core/startup/index.ts index 3021bec9..7c67a811 100644 --- a/server/src/core/startup/index.ts +++ b/server/src/core/startup/index.ts @@ -60,7 +60,10 @@ class Startup { await PlaybooksRepositoryEngine.syncAllRegistered(); this.registerPersistedProviders(); copyAnsibleCfgFileIfDoesntExist(); - await setToCache('_ssm_masterNodeUrl', (await getFromCache('ansible-master-node-url')) || ''); + const masterNodeUrl = await getFromCache('_ssm_masterNodeUrl'); + if (!masterNodeUrl) { + await setToCache('_ssm_masterNodeUrl', (await getFromCache('ansible-master-node-url')) || ''); + } await ContainerCustomStackModel.updateMany( { type: { $exists: false } }, { $set: { type: Repositories.RepositoryType.LOCAL } },