diff --git a/src/Squidex.Domain.Apps.Read/State/Grains/AppStateGrain.cs b/src/Squidex.Domain.Apps.Read/State/Grains/AppStateGrain.cs index b7e1feab2..4d788dd3a 100644 --- a/src/Squidex.Domain.Apps.Read/State/Grains/AppStateGrain.cs +++ b/src/Squidex.Domain.Apps.Read/State/Grains/AppStateGrain.cs @@ -113,7 +113,7 @@ namespace Squidex.Domain.Apps.Read.State.Grains public virtual Task HandleAsync(Envelope message) { - return taskFactory.StartNew(() => + return taskFactory.StartNew(async () => { if (exception != null) { @@ -131,11 +131,22 @@ namespace Squidex.Domain.Apps.Read.State.Grains { if (State.App == null || State.App.Id == appEvent.AppId.Id) { - State.Apply(message); + try + { + State.Apply(message); + + await WriteStateAsync(); + } + catch (InconsistentStateException) + { + await ReadStateAsync(); + + State.Apply(message); + + await WriteStateAsync(); + } } } - - return WriteStateAsync(); }).Unwrap(); } } diff --git a/src/Squidex/Config/Domain/ReadServices.cs b/src/Squidex/Config/Domain/ReadServices.cs index 3f7c70164..44ce25fef 100644 --- a/src/Squidex/Config/Domain/ReadServices.cs +++ b/src/Squidex/Config/Domain/ReadServices.cs @@ -60,6 +60,10 @@ namespace Squidex.Config.Domain exposeSourceUrl)) .As(); + services.AddSingletonAs() + .As() + .As(); + services.AddSingletonAs(c => c.GetService>()?.Value?.Plans.OrEmpty()); services.AddSingletonAs() @@ -86,27 +90,24 @@ namespace Squidex.Config.Domain services.AddSingletonAs() .As(); - services.AddSingletonAs() - .As(); - services.AddSingletonAs() .As(); - services.AddSingletonAs() - .As(); - - services.AddSingletonAs() - .As(); - - services.AddSingletonAs() - .As(); - services.AddSingletonAs() .As(); services.AddSingletonAs() .As(); + services.AddSingletonAs() + .As(); + + services.AddSingletonAs() + .As(); + + services.AddSingletonAs() + .As(); + services.AddSingletonAs(c => new CompoundEventConsumer(c.GetServices().ToArray())); diff --git a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html index 83ba37442..12674ac1d 100644 --- a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html +++ b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html @@ -85,7 +85,7 @@
-
+