Add optional email notifications for daily service restarts#34
Merged
Conversation
The daily restart feature was sending 6 emails because _lastDailyRestartDate was only held in memory. When the service restarted, the field reset to DateTime.MinValue, causing re-triggers within the 2-minute window. Fix: persist the last restart date to XML before initiating the restart, and load it on startup so the new service instance skips the same day. Also adds a "Send Email Notification on Restart" checkbox in the Monitoring tab (enabled by default) so users can disable restart notifications. https://claude.ai/code/session_01FrpJXNzzfYiEA7UXqTMKZf
…aults - Add 7 missing French translation entries in fr.xml for the daily restart checkbox, time label, notification checkbox, and their tooltips - Add monitoring default values to SetDefaultValues() fallback method https://claude.ai/code/session_01FrpJXNzzfYiEA7UXqTMKZf
ApplicationContext.LoadSettings() reloaded log and email settings but never told the scheduler to pick up changed monitoring settings. This meant daily restart time, notification toggle, etc. stayed stale until the next app restart. https://claude.ai/code/session_01FrpJXNzzfYiEA7UXqTMKZf
InitiateServiceRestart() always logged "[MemoryMonitor] Initiating automatic service restart due to critical memory usage" even when called from the daily restart path, making it look like two separate triggers were firing. Now accepts a reason string so logs clearly distinguish between "scheduled daily restart" and "critical memory usage". Also renamed log prefix from [MemoryMonitor] to [ServiceRestart] since the method is shared across callers. https://claude.ai/code/session_01FrpJXNzzfYiEA7UXqTMKZf
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the ability to toggle email notifications when the daily service restart occurs, and improves the persistence of restart state to prevent duplicate restarts after service recovery.
Key Changes
DailyRestartNotificationEnabledconfiguration option (defaults toTrue) to allow users to disable email notifications on daily restartsSaveLastDailyRestartDate()method to persist the last restart date to XML, preventing re-triggering of restarts when the service restarts within the same day windowXMLManagerto read/write the new notification setting and last restart dateApplicationContextwhen settings are savedImplementation Details