Skip to content

Commit e5e6c5d

Browse files
committed
update logic to simplify the code
Signed-off-by: Anand Kumar Singh <[email protected]>
1 parent 767626a commit e5e6c5d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

controllers/notificationsconfiguration/configmap.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ func mapToString(m map[string]string) string {
9898
// return true if there is difference, and false if no changes observed
9999
func checkIfContextChanged(cr *v1alpha1.NotificationsConfiguration, notificationConfigMap *corev1.ConfigMap) bool {
100100
cmContext := strings.Split(strings.TrimSuffix(notificationConfigMap.Data["context"], "\n"), "\n")
101-
if len(cmContext) == len(cr.Spec.Context) {
101+
if len(cmContext) != len(cr.Spec.Context) {
102+
return true
103+
} else {
102104
// Create a map for quick lookups
103105
stringMap := make(map[string]bool)
104106
for _, item := range cmContext {
@@ -111,8 +113,6 @@ func checkIfContextChanged(cr *v1alpha1.NotificationsConfiguration, notification
111113
return true
112114
}
113115
}
114-
} else {
115-
return true
116116
}
117117
return false
118118
}

0 commit comments

Comments
 (0)