-
Notifications
You must be signed in to change notification settings - Fork 787
Feature: Daily settings backup #3283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request introduces a daily backup system for application settings. The implementation creates automatic backups once per day, tracks the last backup date, and maintains a maximum of 10 backup files by cleaning up older ones.
Key changes:
- Added automatic daily backup creation with date tracking to prevent duplicate backups on the same day
- Implemented backup retention policy that keeps only the 10 most recent backup files
- Refactored backup logic into reusable methods that handle both daily backups and legacy file migration
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| Source/NETworkManager.Settings/SettingsManager.cs | Implements daily backup creation, cleanup logic, and refactored backup method; integrates backup creation into the settings save workflow |
| Source/NETworkManager.Settings/SettingsInfo.cs | Adds LastBackup property to track backup dates and updates collection initializer syntax |
| Source/NETworkManager.Settings/GlobalStaticConfiguration.cs | Defines maximum backup file retention limit (10 backups) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@BornToBeRoot I've opened a new pull request, #3284, to work on those changes. Once the pull request is ready, I'll request review from you. |
* Initial plan * Extract date from filename for backup ordering Co-authored-by: BornToBeRoot <[email protected]> * Use InvariantCulture and specific exception handling Co-authored-by: BornToBeRoot <[email protected]> * Move ExtractTimestampFromFilename to TimestampHelper in Utilities Co-authored-by: BornToBeRoot <[email protected]> * Update comment to match specific exception handling Co-authored-by: BornToBeRoot <[email protected]> * Feature: Improve check * Update Source/NETworkManager.Utilities/TimestampHelper.cs Co-authored-by: Copilot <[email protected]> * Update Source/NETworkManager.Utilities/TimestampHelper.cs Co-authored-by: Copilot <[email protected]> * Update Source/NETworkManager.Utilities/TimestampHelper.cs Co-authored-by: Copilot <[email protected]> * Update TimestampHelper.cs * Update TimestampHelper.cs --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: BornToBeRoot <[email protected]> Co-authored-by: Copilot <[email protected]>
Changes proposed in this pull request
Related issue(s)
Copilot generated summary
Provide a Copilot generated summary of the changes in this pull request.
Copilot summary
This pull request introduces a daily backup system for the application's settings file, ensuring that a backup is created only once per day and that old backups are cleaned up according to a configurable retention limit. It also adds tracking of the last backup date and improves backup management during settings migration and saving.
Backup and retention improvements:
CreateDailyBackupIfNeededmethod inSettingsManager.csto create a backup of the settings file only if one hasn't been created for the current day, and to clean up old backups based on a configurable maximum.CleanupBackupsmethod to retain only the most recent backups up to the configured maximum, deleting older ones to manage disk usage.Backupmethod to encapsulate the logic for copying the settings file to the backup location, used during both migration and daily backup routines. [1] [2]Backup_MaximumNumberOfBackupsconstant toGlobalStaticConfiguration.csto configure the maximum number of retained backups.Settings tracking and migration:
LastBackupproperty toSettingsInfo.csto track the date of the last performed backup, ensuring daily backups are not duplicated.Backupmethod for legacy file backup, streamlining and unifying backup operations.Savemethod inSettingsManager.csto callCreateDailyBackupIfNeededbefore saving, ensuring backups are consistently created as needed.Other code improvements:
[]) for the_pingMonitor_HostHistoryfield inSettingsInfo.csfor conciseness.To-Do
Contributing
By submitting this pull request, I confirm the following: