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

Cover completed RoboCopy call without any files transferred.

Try to move the corresponding transfer package out of the processing
location to prevent it from being picked up again and producing the
same problem again, move it to the error location instead and reset the
transfer variables.
parent 34e476d5
No related branches found
No related tags found
No related merge requests found
......@@ -689,6 +689,33 @@ namespace ATxService
}
if (_status.CurrentTransferSrc.Length > 0) {
if (_transferredFiles.Count == 0) {
var msg = "FinalizeTransfers: CurrentTransferSrc is set to " +
$"[{_status.CurrentTransferSrc}], but the list of transferred " +
"files is empty!\nThis indicates something went wrong during the " +
"transfer, maybe a local permission problem?";
Log.Warn(msg);
SendAdminEmail(msg, "Error in FinalizeTransfers()");
try {
var preserve = _status.CurrentTransferSrc
.Replace(_config.ManagedPath, "")
.Replace(@"\", "___");
preserve = Path.Combine(_config.ErrorPath, preserve);
var stale = new DirectoryInfo(_status.CurrentTransferSrc);
stale.MoveTo(preserve);
Log.Warn("Moved stale transfer source to [{0}]!", preserve);
}
catch (Exception ex) {
Log.Error("Preserving the stale transfer source [{0}] in [{1}] failed: {2}",
_status.CurrentTransferSrc, _config.ErrorPath, ex.Message);
}
// reset current transfer variables:
_status.CurrentTransferSrc = "";
_status.CurrentTransferSize = 0;
return;
}
Log.Debug("Finalizing transfer, moving local data to grace location...");
MoveToGraceLocation();
SendTransferCompletedMail();
......
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