Skip to content

Commit 7370258

Browse files
committed
swap deletion and insertion order
1 parent 267a161 commit 7370258

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

pkg/cluster/sync.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -580,15 +580,6 @@ func (c *Cluster) checkAndSetGlobalPostgreSQLConfiguration(pod *v1.Pod, effectiv
580580
}
581581

582582
slotsToSet := make(map[string]interface{})
583-
// check if specified slots exist in config and if they differ
584-
for slotName, desiredSlot := range desiredPatroniConfig.Slots {
585-
if effectiveSlot, exists := effectivePatroniConfig.Slots[slotName]; exists {
586-
if reflect.DeepEqual(desiredSlot, effectiveSlot) {
587-
continue
588-
}
589-
}
590-
slotsToSet[slotName] = desiredSlot
591-
}
592583
// check if there is any slot deletion
593584
for slotName, effectiveSlot := range effectivePatroniConfig.Slots {
594585
if desiredSlot, exists := desiredPatroniConfig.Slots[slotName]; exists {
@@ -598,6 +589,15 @@ func (c *Cluster) checkAndSetGlobalPostgreSQLConfiguration(pod *v1.Pod, effectiv
598589
}
599590
slotsToSet[slotName] = nil
600591
}
592+
// check if specified slots exist in config and if they differ
593+
for slotName, desiredSlot := range desiredPatroniConfig.Slots {
594+
if effectiveSlot, exists := effectivePatroniConfig.Slots[slotName]; exists {
595+
if reflect.DeepEqual(desiredSlot, effectiveSlot) {
596+
continue
597+
}
598+
}
599+
slotsToSet[slotName] = desiredSlot
600+
}
601601
if len(slotsToSet) > 0 {
602602
configToSet["slots"] = slotsToSet
603603
}

0 commit comments

Comments
 (0)