Skip to content

Commit

Permalink
Fix reconcile if-statement
Browse files Browse the repository at this point in the history
  • Loading branch information
grischperl committed Sep 26, 2023
1 parent ed00a91 commit ea123c4
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions internal/controller/eventing/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,24 @@ func (r *Reconciler) reconcileNATSSubManager(ctx context.Context, eventing *v1al
log.Info("NATS subscription-manager initialized")
// save instance only when init is successful.
r.natsSubManager = natsSubManager
}
// update the config if hashes differ
if eventing.Status.BackendConfigHash != specHash && r.isNATSSubManagerStarted {
// set the eventing CR status to processing
if err = r.syncStatusWithSubscriptionManagerProcessingWithReason(ctx,
eventingv1alpha1.ConditionReasonSubscriptionManagerProcessing,
eventing, "Updating NATS subscription-manager with new config.", log); err != nil {
return err
}

// stop the subsManager without cleanup
} else {
// update the config if hashes differ
if eventing.Status.BackendConfigHash != specHash && r.isNATSSubManagerStarted {
// set the eventing CR status to processing
if err = r.syncStatusWithSubscriptionManagerProcessingWithReason(ctx,
eventingv1alpha1.ConditionReasonSubscriptionManagerProcessing,
eventing, "Updating NATS subscription-manager with new config.", log); err != nil {
return err
}

// stop the subsManager without cleanup

if err := r.stopNATSSubManager(false, log); err != nil {
return err
}
return nil

if err := r.stopNATSSubManager(false, log); err != nil {
return err
}
return nil

}

if r.isNATSSubManagerStarted {
Expand Down

0 comments on commit ea123c4

Please sign in to comment.