-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the backup mechanism of the configuration file
The `Config` class was creating a new backup each time `store` was called, which also happens if nothing really changed to the configuration content. With the recently introduced change that backup files are now made unique through a timestamp, this led to a lot of backups being created that were essentially clones. To improve this, the `Config.store` method now only writes the file to disk if the contents in memory have changed. This is done by comparing the checksum of the on disk file and that memory contents as written to a temporary file. If the checksums differ a backup is created of the existing file and the new contents written to the temporary file are copied to the actual configuration file location. This latter new approach also guarantees that the backup is always created before overwriting the original one.
- Loading branch information
Showing
3 changed files
with
52 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters