Skip to content

Commit

Permalink
tip user about timeOut-setting
Browse files Browse the repository at this point in the history
use stopWatch
use more proper exceptiontype
  • Loading branch information
jarped committed Sep 18, 2020
1 parent 8c0039e commit 93e5105
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -567,17 +567,12 @@ private void GetStatusForChangelogOnProvider(int datasetId, string changeLogId)
{
var changeLogStatus = GetChangelogStatusResponse(datasetId, changeLogId);

var starttid = DateTime.Now;
var elapsedTicks = DateTime.Now.Ticks - starttid.Ticks;

var elapsedSpan = new TimeSpan(elapsedTicks);
var stopWatch = Stopwatch.StartNew();

while ((changeLogStatus == ChangelogStatusType.queued || changeLogStatus == ChangelogStatusType.working) &&
elapsedSpan.Minutes < timeout)
stopWatch.Elapsed.TotalMinutes < timeout)
{
System.Threading.Thread.Sleep(3000);
elapsedTicks = DateTime.Now.Ticks - starttid.Ticks;
elapsedSpan = new TimeSpan(elapsedTicks);
changeLogStatus = GetChangelogStatusResponse(datasetId, changeLogId);
}
if (changeLogStatus == ChangelogStatusType.finished)
Expand All @@ -596,7 +591,7 @@ private void GetStatusForChangelogOnProvider(int datasetId, string changeLogId)
throw new IOException("Recieved ChangelogStatus == failed from provider");
default:
Logger.Info("Timeout");
throw new IOException("Timed out waiting for ChangelogStatus == finished from provider");
throw new TimeoutException($"Timed out waiting for ChangelogStatus == finished from provider. Try increasing the TimeOut-value in the .config-file. Current value: {timeout} minutes");
}
}
}
Expand Down

0 comments on commit 93e5105

Please sign in to comment.