Skip to content

Commit

Permalink
🐛 fix: Failure of metric analysis start/end caused by preconditions
Browse files Browse the repository at this point in the history
  • Loading branch information
gangb-tech committed Apr 14, 2023
1 parent 33237f2 commit 88f7dca
Showing 1 changed file with 9 additions and 6 deletions.
Expand Up @@ -138,13 +138,16 @@ public class TargetingService {
@Transactional(rollbackFor = Exception.class)
public TargetingResponse publish(String projectKey, String environmentKey, String toggleKey,
TargetingPublishRequest targetingPublishRequest) {
List<PrerequisiteModel> prerequisites = targetingPublishRequest.getContent().getPrerequisites();
if (!CollectionUtils.isEmpty(prerequisites)){
if (hasDependencyCycle(projectKey, environmentKey, toggleKey, new HashSet<>(prerequisites),
appConfig.getMaximumDependencyDepth())) {
throw new IllegalArgumentException("validate.prerequisite.dependency.cycle");

if (Objects.nonNull(targetingPublishRequest.getContent())) {
List<PrerequisiteModel> prerequisites = targetingPublishRequest.getContent().getPrerequisites();
if (!CollectionUtils.isEmpty(prerequisites)){
if (hasDependencyCycle(projectKey, environmentKey, toggleKey, new HashSet<>(prerequisites),
appConfig.getMaximumDependencyDepth())) {
throw new IllegalArgumentException("validate.prerequisite.dependency.cycle");
}
updateDependentToggles(projectKey, environmentKey, toggleKey, prerequisites);
}
updateDependentToggles(projectKey, environmentKey, toggleKey, prerequisites);
}

Environment environment = selectEnvironment(projectKey, environmentKey);
Expand Down

0 comments on commit 88f7dca

Please sign in to comment.