From 2672e7a79ff1f75dd1a7988164bf83106a92b3a1 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Tue, 6 Feb 2018 16:55:20 +0100 Subject: [PATCH] Wait some grace period between two subsequent transfers. Closes #9 --- ATxService/AutoTx.cs | 9 +++++++++ ATxService/RoboCommand.cs | 1 + 2 files changed, 10 insertions(+) diff --git a/ATxService/AutoTx.cs b/ATxService/AutoTx.cs index 3f76f46..88ebd5d 100644 --- a/ATxService/AutoTx.cs +++ b/ATxService/AutoTx.cs @@ -32,6 +32,7 @@ namespace ATxService private RoboCommand _roboCommand; private long _txCurFileSize; private int _txCurFileProgress; + private int _waitCyclesBeforeNextTx; private DateTime _lastUserDirCheck = DateTime.MinValue; @@ -579,6 +580,14 @@ namespace ATxService return; } + // give the system some time before starting the next transfer: + if (_waitCyclesBeforeNextTx > 0) { + Log.Debug("Waiting {0} more cycles before starting the next transfer...", + _waitCyclesBeforeNextTx); + _waitCyclesBeforeNextTx--; + return; + } + // dispatch the next directory from "processing" for transfer: try { StartTransfer(subdirs[0].FullName); diff --git a/ATxService/RoboCommand.cs b/ATxService/RoboCommand.cs index b89188e..a220cd2 100644 --- a/ATxService/RoboCommand.cs +++ b/ATxService/RoboCommand.cs @@ -164,6 +164,7 @@ namespace ATxService _txCurFileProgress = 0; _roboCommand.Dispose(); _status.TransferInProgress = false; + _waitCyclesBeforeNextTx = 2; } /// <summary> -- GitLab