diff --git a/backend/global.json b/backend/global.json new file mode 100644 index 000000000..3d946171e --- /dev/null +++ b/backend/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "8.0.416" + } +} \ No newline at end of file diff --git a/backend/src/Squidex.Data.EntityFramework/Squidex.Data.EntityFramework.csproj b/backend/src/Squidex.Data.EntityFramework/Squidex.Data.EntityFramework.csproj index 16e9f0d68..e40e948c3 100644 --- a/backend/src/Squidex.Data.EntityFramework/Squidex.Data.EntityFramework.csproj +++ b/backend/src/Squidex.Data.EntityFramework/Squidex.Data.EntityFramework.csproj @@ -40,13 +40,13 @@ - - - - - - - + + + + + + + diff --git a/backend/src/Squidex.Data.MongoDb/Squidex.Data.MongoDb.csproj b/backend/src/Squidex.Data.MongoDb/Squidex.Data.MongoDb.csproj index 2fea86f27..ba3b3c4d6 100644 --- a/backend/src/Squidex.Data.MongoDb/Squidex.Data.MongoDb.csproj +++ b/backend/src/Squidex.Data.MongoDb/Squidex.Data.MongoDb.csproj @@ -25,12 +25,12 @@ - - - - - - + + + + + + diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj b/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj index 35a513d82..622922e8e 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj @@ -20,7 +20,7 @@ - + diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj b/backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj index 124859b6b..4b11ee781 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj @@ -29,8 +29,8 @@ - - + + diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/Consume/EventConsumerProcessor.cs b/backend/src/Squidex.Infrastructure/EventSourcing/Consume/EventConsumerProcessor.cs index e53dfcfe4..9202f962e 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/Consume/EventConsumerProcessor.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/Consume/EventConsumerProcessor.cs @@ -21,6 +21,7 @@ public class EventConsumerProcessor : IEventSubscriber private readonly IEventStore eventStore; private readonly ILogger log; private readonly AsyncLock asyncLock = new AsyncLock(); + private readonly RetryWindow logWindow = new RetryWindow(TimeSpan.FromSeconds(10), 0); private IEventSubscription? currentSubscription; public EventConsumerState State @@ -73,9 +74,9 @@ public class EventConsumerProcessor : IEventSubscriber } } - public virtual async ValueTask OnNextAsync(IEventSubscription subscription, ParsedEvents @event) + public virtual ValueTask OnNextAsync(IEventSubscription subscription, ParsedEvents @event) { - await UpdateAsync(async () => + return UpdateAsync(async () => { if (!ReferenceEquals(subscription, currentSubscription)) { @@ -83,14 +84,13 @@ public class EventConsumerProcessor : IEventSubscriber } await DispatchAsync(@event.Events); - State = State.Handled(@event.Position, @event.Events.Count); }, State.Position); } - public virtual async ValueTask OnErrorAsync(IEventSubscription subscription, Exception exception) + public virtual ValueTask OnErrorAsync(IEventSubscription subscription, Exception exception) { - await UpdateAsync(() => + return UpdateAsync(() => { if (!ReferenceEquals(subscription, currentSubscription)) { @@ -98,12 +98,16 @@ public class EventConsumerProcessor : IEventSubscriber } Unsubscribe(); - State = State.Stopped(exception); + + if (logWindow.CanRetryAfterFailure()) + { + log.LogError(exception, "Failed to handle event."); + } }, State.Position); } - public virtual Task ActivateAsync() + public virtual ValueTask ActivateAsync() { return UpdateAsync(() => { @@ -120,7 +124,7 @@ public class EventConsumerProcessor : IEventSubscriber }, State.Position); } - public virtual Task StartAsync() + public virtual ValueTask StartAsync() { return UpdateAsync(() => { @@ -130,12 +134,11 @@ public class EventConsumerProcessor : IEventSubscriber } Subscribe(); - State = State.Started(); }, State.Position); } - public virtual Task StopAsync() + public virtual ValueTask StopAsync() { return UpdateAsync(() => { @@ -145,7 +148,6 @@ public class EventConsumerProcessor : IEventSubscriber } Unsubscribe(); - State = State.Stopped(); }, State.Position); } @@ -164,7 +166,6 @@ public class EventConsumerProcessor : IEventSubscriber await ClearAsync(); State = EventConsumerState.Initial; - Subscribe(); }, State.Position); } @@ -177,7 +178,7 @@ public class EventConsumerProcessor : IEventSubscriber } } - private Task UpdateAsync(Action action, string? position, [CallerMemberName] string? caller = null) + private ValueTask UpdateAsync(Action action, string? position, [CallerMemberName] string? caller = null) { return UpdateAsync(() => { @@ -187,7 +188,7 @@ public class EventConsumerProcessor : IEventSubscriber }, position, caller); } - private async Task UpdateAsync(Func action, string? position, [CallerMemberName] string? caller = null) + private async ValueTask UpdateAsync(Func action, string? position, [CallerMemberName] string? caller = null) { // We do not want to deal with concurrency in this class, therefore we just use a lock. using (await asyncLock.EnterAsync()) diff --git a/backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj b/backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj index e337a4143..1c100f743 100644 --- a/backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj +++ b/backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj @@ -24,13 +24,13 @@ - - - - - - - + + + + + + + diff --git a/backend/src/Squidex/Squidex.csproj b/backend/src/Squidex/Squidex.csproj index 699c816cb..4d7accc58 100644 --- a/backend/src/Squidex/Squidex.csproj +++ b/backend/src/Squidex/Squidex.csproj @@ -60,17 +60,17 @@ - - - - - - + + + + + + - - - - + + + + @@ -84,11 +84,11 @@ - + - + diff --git a/frontend/src/app/shared/state/asset-scripts.state.ts b/frontend/src/app/shared/state/asset-scripts.state.ts index ab02bddd4..92e2caf7c 100644 --- a/frontend/src/app/shared/state/asset-scripts.state.ts +++ b/frontend/src/app/shared/state/asset-scripts.state.ts @@ -99,10 +99,10 @@ export class AssetScriptsState extends State { } private replaceAssetScripts(payload: AssetScriptsDto, version: VersionTag) { - const { canUpdate, _links: _, version: __, ...scripts } = payload.toJSON(); + const { _links: _, version: __, ...scripts } = payload.toJSON(); this.next({ - canUpdate, + canUpdate: payload.canUpdate, scripts, isLoaded: true, isLoading: false,