Skip to content

Commit aa23fd0

Browse files
Use streaming endpoint for contents.
1 parent 42b1512 commit aa23fd0

File tree

6 files changed

+25
-6
lines changed

6 files changed

+25
-6
lines changed

cli/Squidex.CLI/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
<PackageTags>Squidex HeadlessCMS</PackageTags>
1616
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1717
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
18-
<Version>13.4</Version>
18+
<Version>13.6</Version>
1919
</PropertyGroup>
2020
</Project>

cli/Squidex.CLI/Squidex.CLI.Core/Commands/Implementation/Sync/Contents/ContentsSynchronizer.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Task SaveAsync()
7777
});
7878
}
7979

80-
await client.GetAllAsync(async content =>
80+
async Task HandleContentAsync(DynamicContent content)
8181
{
8282
if (content.LastModified < options.MaxAgeDate)
8383
{
@@ -96,7 +96,16 @@ await client.GetAllAsync(async content =>
9696
contents.Clear();
9797
contentBatch++;
9898
}
99-
}, context: context);
99+
}
100+
101+
if (options.StreamContents)
102+
{
103+
await client.StreamAllAsync(HandleContentAsync, context: context);
104+
}
105+
else
106+
{
107+
await client.GetAllAsync(HandleContentAsync, context: context);
108+
}
100109

101110
if (contents.Count > 0)
102111
{

cli/Squidex.CLI/Squidex.CLI.Core/Commands/Implementation/Sync/Schemas/SchemasSynchronizer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public async Task ImportAsync(ISyncService sync, SyncOptions options, ISession s
107107
{
108108
foreach (var name in current.Items.Select(x => x.Name))
109109
{
110-
if (createModels.All(x => x.Name != name))
110+
if (createModels.TrueForAll(x => x.Name != name))
111111
{
112112
await log.DoSafeAsync($"Schema {name} deleting", async () =>
113113
{

cli/Squidex.CLI/Squidex.CLI.Core/Commands/Implementation/Sync/SyncOptions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public sealed class SyncOptions
1919

2020
public bool Recreate { get; set; }
2121

22+
public bool StreamContents { get; set; }
23+
2224
public bool UpdateCurrentClient { get; set; }
2325

2426
public DateTimeOffset MaxAgeDate { get; set; }

cli/Squidex.CLI/Squidex.CLI.Core/Commands/Implementation/Sync/Workflows/WorkflowsSynchronizer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public async Task ImportAsync(ISyncService sync, SyncOptions options, ISession s
101101
{
102102
foreach (var (name, workflow) in workflowsByName.ToList())
103103
{
104-
if (models.All(x => x.Name == name))
104+
if (models.TrueForAll(x => x.Name == name))
105105
{
106106
await log.DoSafeAsync($"Workflow '{name}' deleting", async () =>
107107
{

cli/Squidex.CLI/Squidex.CLI/Commands/App_Sync.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ public sealed class OutArguments : AppArguments
156156
[Option('t', "targets", Description = "The targets to sync, e.g. ‘sync out -t contents -t schemas’. Use 'sync targets' to view all targets.")]
157157
public string[] Targets { get; set; }
158158

159+
[Option("stream-contents", Description = "Use the new streaming API for contents.")]
160+
public bool StreamContents { get; set; }
161+
159162
[Option("max-age", Description = "Content & assets created or last modified within time span defined.")]
160163
public TimeSpan? MaxAge { get; set; }
161164

@@ -164,7 +167,12 @@ public sealed class OutArguments : AppArguments
164167

165168
public SyncOptions ToOptions()
166169
{
167-
return new SyncOptions { Targets = Targets, MaxAgeDate = GetMaxAgeDate() };
170+
return new SyncOptions
171+
{
172+
Targets = Targets,
173+
MaxAgeDate = GetMaxAgeDate(),
174+
StreamContents = StreamContents
175+
};
168176
}
169177

170178
public sealed class Validator : AbstractValidator<OutArguments>

0 commit comments

Comments
 (0)