Skip to content

Commit

Permalink
Fix bug in download and upload pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Nov 16, 2021
1 parent abdde21 commit 5c7ed75
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 20 deletions.
1 change: 0 additions & 1 deletion cli/Squidex.CLI/Squidex.CLI/Commands/App_Assets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// ==========================================================================

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down
1 change: 0 additions & 1 deletion cli/Squidex.CLI/Squidex.CLI/Commands/App_Backup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using CommandDotNet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

using System;
using Newtonsoft.Json;
using Squidex.ClientLibrary;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using System.Threading.Tasks.Dataflow;
using CsvHelper;
using CsvHelper.Configuration;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Squidex.ClientLibrary;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// ==========================================================================

using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Squidex.CLI.Commands.Implementation.FileSystem;
using Squidex.ClientLibrary.Management;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public async Task ImportAsync(ISyncService sync, SyncOptions options, ISession s

var tree = new FolderTree(session);

var batchIndex = 0;

foreach (var (_, model) in models)
{
if (model?.Assets?.Count > 0)
Expand Down Expand Up @@ -140,7 +142,7 @@ public async Task ImportAsync(ISyncService sync, SyncOptions options, ISession s
var result1 = results.FirstOrDefault(x => x.JobIndex == (assetIndex * 2));
var result2 = results.FirstOrDefault(x => x.JobIndex == (assetIndex * 2) + 1);

log.StepStart($"Upserting #{assetIndex}");
log.StepStart($"Upserting #{batchIndex}/{assetIndex}");

if (result1?.Error != null)
{
Expand All @@ -162,6 +164,8 @@ public async Task ImportAsync(ISyncService sync, SyncOptions options, ISession s
assetIndex++;
}
}

batchIndex++;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// ==========================================================================

using System;
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using Squidex.CLI.Commands.Implementation.FileSystem;
Expand Down Expand Up @@ -111,7 +109,7 @@ public Task DownloadAsync(AssetDto asset)

public Task CompleteAsync()
{
pipelineEnd.Complete();
pipelineStart.Complete();

return pipelineEnd.Completion;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// ==========================================================================

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using Squidex.CLI.Commands.Implementation.FileSystem;
Expand Down Expand Up @@ -71,14 +70,7 @@ public UploadPipeline(ISession session, ILogger log, IFileSystem fs)
var result = await session.Assets.PostUpsertAssetAsync(session.App, asset.Id, null, true, file);
if (string.Equals(asset.FileHash, result.FileHash, StringComparison.Ordinal))
{
log.ProcessSkipped(process, "Same hash.");
}
else
{
log.ProcessCompleted(process);
}
log.ProcessCompleted(process);
}
}
catch (Exception ex)
Expand Down Expand Up @@ -108,7 +100,7 @@ public Task UploadAsync(AssetModel asset)

public Task CompleteAsync()
{
pipelineEnd.Complete();
pipelineStart.Complete();

return pipelineEnd.Completion;
}
Expand Down
2 changes: 1 addition & 1 deletion cli/Squidex.CLI/Squidex.CLI/Squidex.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<TargetFramework>net5.0</TargetFramework>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<ToolCommandName>sq</ToolCommandName>
<Version>7.23</Version>
<Version>7.24</Version>
</PropertyGroup>
<ItemGroup>
<None Remove="Commands\Implementation\OpenLibrary\Structure\schemas\author.json" />
Expand Down

0 comments on commit 5c7ed75

Please sign in to comment.