Improved the save operation of settings by using a temporary file (#237)

This commit is contained in:
Thorsten Sommer 2025-01-01 17:15:04 +01:00 committed by GitHub
parent 8cbef49d89
commit 2131bf1817
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -118,8 +118,10 @@ public sealed class SettingsManager(ILogger<SettingsManager> logger)
} }
var settingsJson = JsonSerializer.Serialize(this.ConfigurationData, JSON_OPTIONS); var settingsJson = JsonSerializer.Serialize(this.ConfigurationData, JSON_OPTIONS);
await File.WriteAllTextAsync(settingsPath, settingsJson); var tempFile = Path.GetTempFileName();
await File.WriteAllTextAsync(tempFile, settingsJson);
File.Move(tempFile, settingsPath, true);
this.logger.LogInformation("Stored the settings to the file system."); this.logger.LogInformation("Stored the settings to the file system.");
} }

View File

@ -2,5 +2,6 @@
- Added an ERI server coding assistant as a preview feature behind the RAG feature flag. This helps you implement an ERI server to gain access to, e.g., your enterprise data from within AI Studio. - Added an ERI server coding assistant as a preview feature behind the RAG feature flag. This helps you implement an ERI server to gain access to, e.g., your enterprise data from within AI Studio.
- Improved provider requests by handling rate limits by retrying requests. - Improved provider requests by handling rate limits by retrying requests.
- Improved the creation of the "the bias of the day" workspace; create that workspace only when the bias of the day feature is used. - Improved the creation of the "the bias of the day" workspace; create that workspace only when the bias of the day feature is used.
- Improved the save operation of settings by using a temporary file to avoid data loss in rare cases.
- Fixed layout issues when selecting `other` items (e.g., programming languages). - Fixed layout issues when selecting `other` items (e.g., programming languages).
- Fixed a bug about the bias of the day workspace when the workspace component was hidden. - Fixed a bug about the bias of the day workspace when the workspace component was hidden.