Skip to content

Commit

Permalink
Minor tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
davissp14 committed Jul 8, 2024
1 parent 336f798 commit 55965f9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cmd/monitor/monitor_backup_schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ func monitorBackupSchedule(ctx context.Context, node *flypg.Node, barman *flypg.
// Recalculate the next scheduled backup time after the initial backup.
nextScheduledBackup = calculateNextBackupTime(barman, lastBackupTime)
}
log.Printf("[INFO] Next full backup due in: %s", nextScheduledBackup)
} else {
// Ensure the ticker has a valid duration if we are not the primary.
if nextScheduledBackup < 0 {
nextScheduledBackup = backupFrequency(barman)
}
}

// Safety net in case ticker does not have a valid duration.
if nextScheduledBackup < 0 {
nextScheduledBackup = backupFrequency(barman)
}

log.Printf("[INFO] Next full backup due in: %s", nextScheduledBackup)

// Monitor the backup schedule even if we are not the primary. This is to ensure backups will
// continue to be taken in the event of a failover.
ticker := time.NewTicker(nextScheduledBackup)
Expand Down

0 comments on commit 55965f9

Please sign in to comment.