diff --git a/Directory.Build.props b/Directory.Build.props index 8a65bc8..b0e6507 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 1.2.0-preview.4 - 1.2.1-preview.8 + 1.2.0-preview.5 + 1.2.1-preview.10 \ No newline at end of file diff --git a/Masa.Dcc.Infrastructure.Domain/Services/ConfigObjectDomainService.cs b/Masa.Dcc.Infrastructure.Domain/Services/ConfigObjectDomainService.cs index 859a823..2991f18 100644 --- a/Masa.Dcc.Infrastructure.Domain/Services/ConfigObjectDomainService.cs +++ b/Masa.Dcc.Infrastructure.Domain/Services/ConfigObjectDomainService.cs @@ -526,13 +526,6 @@ public async Task InitConfigObjectAsync( foreach (var configObject in configObjects) { var configObjectName = configObject.Key; - var key = $"{environmentName}-{clusterName}-{appId}-{configObjectName}".ToLower(); - var redisData = await _memoryCacheClient.GetAsync(key); - if (redisData != null) - { - continue; - } - string content = configObject.Value; if (isEncryption) content = EncryptContent(content); @@ -573,8 +566,18 @@ public async Task InitConfigObjectAsync( } } } - await _configObjectRepository.AddAsync(newConfigObject); - await _unitOfWork.SaveChangesAsync(); + if (await _configObjectRepository.FindAsync(x => x.Name == newConfigObject.Name && x.Type == newConfigObject.Type) == null) + { + await _configObjectRepository.AddAsync(newConfigObject); + await _unitOfWork.SaveChangesAsync(); + } + + var key = $"{environmentName}-{clusterName}-{appId}-{configObjectName}".ToLower(); + var redisData = await _memoryCacheClient.GetAsync(key); + if (redisData != null) + { + continue; + } var releaseModel = new AddConfigObjectReleaseDto {