From 8c159d223547fada93b59e2055c9b7e37399110f Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Thu, 19 Jul 2018 12:17:24 +0200
Subject: [PATCH] Move zero-sized transfer dirs out of the way

Otherwise AutoTx will try to process them in each iteration but fail
right away, thus blocking all other transfers while the dir is there.

Fixes #49
---
 ATxService/RoboCommand.cs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ATxService/RoboCommand.cs b/ATxService/RoboCommand.cs
index 76b3b5b..35369b5 100644
--- a/ATxService/RoboCommand.cs
+++ b/ATxService/RoboCommand.cs
@@ -26,6 +26,11 @@ namespace ATxService
             if (totalSize == 0) {
                 Log.Warn("Total size of all files in [{0}] is zero, NOT STARTING a transfer!",
                     sourcePath);
+                // we also have to move it out of the way, otherwise it will block all transfers:
+                var sourceDir = new DirectoryInfo(sourcePath);
+                var errorTargetPath = Path.Combine(_config.ErrorPath, TimeUtils.Timestamp());
+                sourceDir.MoveTo(errorTargetPath);
+                Log.Warn("Moved empty directory tree [{0}] to [{1}].", sourcePath, errorTargetPath);
                 return;
             }
             Log.Debug("Size of all files under [{0}] is {1} bytes ({2})",
-- 
GitLab