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

Remove the CheckGraceLocation() wrapper.

Make GraceLocationSummary() return an empty string instead, if no
expired folders exist in the grace location.

Refers to #1
parent 1c76434a
No related branches found
No related tags found
No related merge requests found
...@@ -213,12 +213,17 @@ namespace AutoTx ...@@ -213,12 +213,17 @@ namespace AutoTx
} }
msg += "\n------ Grace location status ------\n"; msg += "\n------ Grace location status (threshold: " + _config.GracePeriod + ") ------\n";
try { try {
msg += GraceLocationSummary(_config.GracePeriod); var tmp = GraceLocationSummary(_config.GracePeriod);
if (string.IsNullOrEmpty(tmp)) {
msg += " -- NO EXPIRED folders in grace location! --\n";
} else {
msg += tmp;
}
} }
catch (Exception ex) { catch (Exception ex) {
writeLog("CheckGraceLocation() failed: " + ex.Message, true); writeLog("GraceLocationSummary() failed: " + ex.Message, true);
} }
if (!string.IsNullOrEmpty(_config.ValidationWarnings)) { if (!string.IsNullOrEmpty(_config.ValidationWarnings)) {
...@@ -766,7 +771,7 @@ namespace AutoTx ...@@ -766,7 +771,7 @@ namespace AutoTx
sourceDirectory.Parent.Delete(); sourceDirectory.Parent.Delete();
// check age and size of existing folders in the grace location after // check age and size of existing folders in the grace location after
// a transfer has completed, trigger a notification if necessary: // a transfer has completed, trigger a notification if necessary:
CheckGraceLocation(); writeLogDebug(GraceLocationSummary(_config.GracePeriod));
return; return;
} }
errMsg = "unable to move " + sourceDirectory.FullName; errMsg = "unable to move " + sourceDirectory.FullName;
...@@ -923,10 +928,6 @@ namespace AutoTx ...@@ -923,10 +928,6 @@ namespace AutoTx
.Sum(file => file.Length); .Sum(file => file.Length);
} }
public void CheckGraceLocation() {
writeLogDebug(GraceLocationSummary(_config.GracePeriod));
}
/// <summary> /// <summary>
/// Generate a report on expired folders in the grace location. /// Generate a report on expired folders in the grace location.
/// ///
...@@ -946,8 +947,9 @@ namespace AutoTx ...@@ -946,8 +947,9 @@ namespace AutoTx
} }
} }
if (string.IsNullOrEmpty(report)) if (string.IsNullOrEmpty(report))
report = " -- NONE --\n"; return "";
return "Folders older than " + threshold + " days in grace location:\n" + report; report = "Expired folders in grace location:\n" + report;
return report;
} }
/// <summary> /// <summary>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment