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

Commit f6d2eee

Browse files
author
Lilian ARAGO
committed
Fix progression display
1 parent 58b5ade commit f6d2eee

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

TCC.Lib/TarCompressCrypt.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ public async Task<OperationSummary> CompressAsync(CompressOption option)
9090

9191
private async Task<OperationCompressionBlock> UploadBlockInternal(IEnumerable<IRemoteStorage> uploaders, CompressOption option, OperationCompressionBlock block, CancellationToken token)
9292
{
93-
foreach(var uploader in uploaders)
93+
int count = Interlocked.Increment(ref _uploadCounter);
94+
string progress = $"{count}/{_totalCounter}";
95+
96+
foreach (var uploader in uploaders)
9497
{
9598
if (uploader is NoneRemoteStorage)
9699
{
97100
continue;
98101
}
99102

100-
int count = Interlocked.Increment(ref _uploadCounter);
101-
string progress = $"{count}/{_totalCounter}";
102-
103103
var file = block.CompressionBlock.DestinationArchiveFileInfo;
104104
var name = file.Name;
105105
RetryContext ctx = null;
@@ -129,15 +129,15 @@ private async Task<OperationCompressionBlock> UploadBlockInternal(IEnumerable<IR
129129

130130
if (!hasError)
131131
{
132-
_logger.LogInformation($"{progress} Uploaded \"{file.Name}\" in {sw.Elapsed.HumanizedTimeSpan()} at {speed.HumanizedBandwidth()} ");
132+
_logger.LogInformation($"[{uploader.GetMode()}] {progress} Uploaded \"{file.Name}\" in {sw.Elapsed.HumanizedTimeSpan()} at {speed.HumanizedBandwidth()} ");
133133
}
134134
else
135135
{
136136
if (ctx == null && option.RetryPeriodInSeconds.HasValue)
137137
{
138138
ctx = new RetryContext(option.RetryPeriodInSeconds.Value);
139139
}
140-
_logger.LogError($"{progress} Uploaded {file.Name} with errors. {result.ErrorMessage}");
140+
_logger.LogError($"[{uploader.GetMode()}] {progress} Uploaded {file.Name} with errors. {result.ErrorMessage}");
141141
}
142142
}
143143
catch (Exception e)
@@ -147,14 +147,14 @@ private async Task<OperationCompressionBlock> UploadBlockInternal(IEnumerable<IR
147147
{
148148
ctx = new RetryContext(option.RetryPeriodInSeconds.Value);
149149
}
150-
_logger.LogCritical(e, $"{progress} Error uploading {name}");
150+
_logger.LogCritical(e, $"[{uploader.GetMode()}] {progress} Error uploading {name}");
151151
}
152152

153153
if (hasError)
154154
{
155155
if (ctx != null && await ctx.WaitForNextRetry())
156156
{
157-
_logger.LogWarning($"{progress} Retrying uploading {name}, attempt #{ctx.Retries}");
157+
_logger.LogWarning($"[{uploader.GetMode()}] {progress} Retrying uploading {name}, attempt #{ctx.Retries}");
158158
}
159159
else
160160
{

TCC.Tests/Upload/BlobStorageTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public async Task GoogleUploadTest()
6363

6464
Assert.True(ok.IsSuccess);
6565

66-
var gs = uploader as GoogleRemoteStorage;
66+
var gs = uploader.First() as GoogleRemoteStorage;
6767

6868
await gs.Storage.DeleteObjectAsync(gs.BucketName, ok.RemoteFilePath);
6969
}

0 commit comments

Comments
 (0)