Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
Adds retry policy in exception error paths
Browse files Browse the repository at this point in the history
  • Loading branch information
rducom committed Oct 12, 2021
1 parent 21158b4 commit c73a6d3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion TCC.Lib/TarCompressCrypt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,17 @@ private async Task<OperationCompressionBlock> UploadBlockInternal(IRemoteStorage

sw.Stop();

if (result.IsSuccess)
if (!hasError)
{
double speed = file.Length / sw.Elapsed.TotalSeconds;
_logger.LogInformation($"{progress} Uploaded \"{file.Name}\" in {sw.Elapsed.HumanizedTimeSpan()} at {speed.HumanizedBandwidth()} ");
}
else
{
if (ctx == null && option.RetryPeriodInSeconds.HasValue)
{
ctx = new RetryContext(option.RetryPeriodInSeconds.Value);
}
_logger.LogError($"{progress} Uploaded {file.Name} with errors. {result.ErrorMessage}");
}
}
Expand Down Expand Up @@ -261,6 +265,10 @@ private async Task<OperationCompressionBlock> CompressionBlockInternal(CompressO
if (result.HasError)
{
hasError = true;
if (ctx == null && option.RetryPeriodInSeconds.HasValue)
{
ctx = new RetryContext(option.RetryPeriodInSeconds.Value);
}
}
var report = $"{progress} [{block.BackupMode}] : {block.BlockName}";
if (block.BackupMode == BackupMode.Diff)
Expand Down

0 comments on commit c73a6d3

Please sign in to comment.