Skip to content
Snippets Groups Projects
Commit 02ab2538 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Add grace location summary to low space notification

Fixes #41
parent 634a7b7c
No related branches found
No related tags found
No related merge requests found
...@@ -116,6 +116,12 @@ namespace ATxService ...@@ -116,6 +116,12 @@ namespace ATxService
return; return;
} }
// reaching this point means a notification will be sent to the admin, and in that
// case it makes sense to also include details about the grace location:
var graceReport = FsUtils.GraceLocationSummary(
new DirectoryInfo(_config.DonePath), _config.GracePeriod);
Log.Warn("WARNING: {0}", spaceDetails); Log.Warn("WARNING: {0}", spaceDetails);
_status.LastStorageNotification = DateTime.Now; _status.LastStorageNotification = DateTime.Now;
...@@ -127,6 +133,8 @@ namespace ATxService ...@@ -127,6 +133,8 @@ namespace ATxService
}; };
try { try {
var body = LoadMailTemplate("DiskSpace-Low.txt", substitutions); var body = LoadMailTemplate("DiskSpace-Low.txt", substitutions);
if (graceReport.Length > 0)
body += $"\n\n--\n{graceReport}";
SendEmail(_config.AdminEmailAdress, "low disk space", body); SendEmail(_config.AdminEmailAdress, "low disk space", body);
} }
catch (Exception ex) { catch (Exception ex) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment