Skip to content

Commit 5c7ed75

Browse files
Fix bug in download and upload pipeline
1 parent abdde21 commit 5c7ed75

File tree

9 files changed

+9
-20
lines changed

9 files changed

+9
-20
lines changed

cli/Squidex.CLI/Squidex.CLI/Commands/App_Assets.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// ==========================================================================
77

88
using System;
9-
using System.Collections.Concurrent;
109
using System.Collections.Generic;
1110
using System.IO;
1211
using System.Linq;

cli/Squidex.CLI/Squidex.CLI/Commands/App_Backup.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
using System;
99
using System.IO;
10-
using System.Linq;
1110
using System.Threading;
1211
using System.Threading.Tasks;
1312
using CommandDotNet;

cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/OpenLibrary/AuthorContent.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// All rights reserved. Licensed under the MIT license.
66
// ==========================================================================
77

8-
using System;
98
using Newtonsoft.Json;
109
using Squidex.ClientLibrary;
1110

cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/OpenLibrary/AuthorImporter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using System.Threading.Tasks.Dataflow;
1414
using CsvHelper;
1515
using CsvHelper.Configuration;
16-
using Newtonsoft.Json;
1716
using Newtonsoft.Json.Linq;
1817
using Squidex.ClientLibrary;
1918

cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Sync/App/AppSynchronizer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// ==========================================================================
77

88
using System.Collections.Generic;
9-
using System.Linq;
109
using System.Threading.Tasks;
1110
using Squidex.CLI.Commands.Implementation.FileSystem;
1211
using Squidex.ClientLibrary.Management;

cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Sync/Assets/AssetsSynchronizer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public async Task ImportAsync(ISyncService sync, SyncOptions options, ISession s
9999

100100
var tree = new FolderTree(session);
101101

102+
var batchIndex = 0;
103+
102104
foreach (var (_, model) in models)
103105
{
104106
if (model?.Assets?.Count > 0)
@@ -140,7 +142,7 @@ public async Task ImportAsync(ISyncService sync, SyncOptions options, ISession s
140142
var result1 = results.FirstOrDefault(x => x.JobIndex == (assetIndex * 2));
141143
var result2 = results.FirstOrDefault(x => x.JobIndex == (assetIndex * 2) + 1);
142144

143-
log.StepStart($"Upserting #{assetIndex}");
145+
log.StepStart($"Upserting #{batchIndex}/{assetIndex}");
144146

145147
if (result1?.Error != null)
146148
{
@@ -162,6 +164,8 @@ public async Task ImportAsync(ISyncService sync, SyncOptions options, ISession s
162164
assetIndex++;
163165
}
164166
}
167+
168+
batchIndex++;
165169
}
166170
}
167171

cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Sync/Assets/DownloadPipeline.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
// ==========================================================================
77

88
using System;
9-
using System.IO;
10-
using System.Security.Cryptography;
119
using System.Threading.Tasks;
1210
using System.Threading.Tasks.Dataflow;
1311
using Squidex.CLI.Commands.Implementation.FileSystem;
@@ -111,7 +109,7 @@ public Task DownloadAsync(AssetDto asset)
111109

112110
public Task CompleteAsync()
113111
{
114-
pipelineEnd.Complete();
112+
pipelineStart.Complete();
115113

116114
return pipelineEnd.Completion;
117115
}

cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Sync/Assets/UploadPipeline.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// ==========================================================================
77

88
using System;
9-
using System.Collections.Generic;
109
using System.Threading.Tasks;
1110
using System.Threading.Tasks.Dataflow;
1211
using Squidex.CLI.Commands.Implementation.FileSystem;
@@ -71,14 +70,7 @@ public UploadPipeline(ISession session, ILogger log, IFileSystem fs)
7170

7271
var result = await session.Assets.PostUpsertAssetAsync(session.App, asset.Id, null, true, file);
7372

74-
if (string.Equals(asset.FileHash, result.FileHash, StringComparison.Ordinal))
75-
{
76-
log.ProcessSkipped(process, "Same hash.");
77-
}
78-
else
79-
{
80-
log.ProcessCompleted(process);
81-
}
73+
log.ProcessCompleted(process);
8274
}
8375
}
8476
catch (Exception ex)
@@ -108,7 +100,7 @@ public Task UploadAsync(AssetModel asset)
108100

109101
public Task CompleteAsync()
110102
{
111-
pipelineEnd.Complete();
103+
pipelineStart.Complete();
112104

113105
return pipelineEnd.Completion;
114106
}

cli/Squidex.CLI/Squidex.CLI/Squidex.CLI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<TargetFramework>net5.0</TargetFramework>
1515
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
1616
<ToolCommandName>sq</ToolCommandName>
17-
<Version>7.23</Version>
17+
<Version>7.24</Version>
1818
</PropertyGroup>
1919
<ItemGroup>
2020
<None Remove="Commands\Implementation\OpenLibrary\Structure\schemas\author.json" />

0 commit comments

Comments
 (0)