Skip to content

Commit 5749c0f

Browse files
committed
dont stop watcher, gate the logic and continue
1 parent b08eb97 commit 5749c0f

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

percona/controller/pgcluster/controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,8 @@ func (r *PGClusterReconciler) reconcileExternalWatchers(ctx context.Context, cr
978978
}
979979

980980
func (r *PGClusterReconciler) startExternalWatchers(ctx context.Context, cr *v2.PerconaPGCluster) error {
981+
log := logging.FromContext(ctx)
982+
981983
if !cr.Spec.Backups.IsEnabled() {
982984
return nil
983985
}
@@ -986,8 +988,6 @@ func (r *PGClusterReconciler) startExternalWatchers(ctx context.Context, cr *v2.
986988
return nil
987989
}
988990

989-
log := logging.FromContext(ctx)
990-
991991
watcherName, watcherFunc := watcher.GetWALWatcher(cr)
992992
if r.Watchers.IsExist(watcherName) {
993993
return nil

percona/watcher/wal.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ func WatchCommitTimestamps(ctx context.Context, cli client.Client, eventChan cha
5656
for {
5757
select {
5858
case <-ticker.C:
59-
log.V(1).Info("Running WAL watcher")
60-
6159
localCr := cr.DeepCopy()
6260
err := cli.Get(ctx, client.ObjectKeyFromObject(cr), localCr)
6361
if err != nil {
@@ -66,9 +64,9 @@ func WatchCommitTimestamps(ctx context.Context, cli client.Client, eventChan cha
6664
}
6765

6866
if !localCr.Spec.Backups.IsEnabled() {
69-
log.Info("Backups are disabled, stopping WAL watcher")
70-
return
67+
continue
7168
}
69+
log.V(1).Info("Running WAL watcher")
7270

7371
latestBackup, err := getLatestBackup(ctx, cli, localCr)
7472
if err != nil {

0 commit comments

Comments
 (0)