Skip to content

Commit

Permalink
Prevent duplicate cache setting for masterNodeUrl
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
SquirrelDevelopper committed Nov 14, 2024
1 parent 31e7187 commit f383e0e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/src/core/startup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 } },
Expand Down

0 comments on commit f383e0e

Please sign in to comment.