Skip to content

Commit

Permalink
feature. fix check logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkfree committed Apr 24, 2024
1 parent 7375c83 commit fec7022
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion cmd/server/system_notification_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,24 @@ func processSystemNotificationRule() error {
log.Error(context.TODO(), err)
continue
}
rulerConfig.Groups = rc.Groups

// Check exist
for _, systemNotificationRule := range rc.Groups[0].Rules {
exist := false
for i, rule := range rulerConfig.Groups[0].Rules {
if rule.Annotations.SystemNotificationRuleId == systemNotificationRule.Annotations.SystemNotificationRuleId {
rulerConfig.Groups[0].Rules[i] = systemNotificationRule
exist = true
break
}
}

if !exist {
rulerConfig.Groups[0].Rules = append(rulerConfig.Groups[0].Rules, systemNotificationRule)
}
}

//rulerConfig.Groups = rc.Groups

/*
outYaml, err := yaml.Marshal(rulerConfig)
Expand Down

0 comments on commit fec7022

Please sign in to comment.