diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/Consume/EventConsumerProcessor.cs b/backend/src/Squidex.Infrastructure/EventSourcing/Consume/EventConsumerProcessor.cs index 9202f962e..2417afeb3 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/Consume/EventConsumerProcessor.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/Consume/EventConsumerProcessor.cs @@ -72,6 +72,9 @@ public class EventConsumerProcessor : IEventSubscriber log.LogCritical(ex, "Failed to complete consumer."); } } + + // Acquire the lock to ensure any in-flight UpdateAsync has fully completed before returning. + using var _ = await asyncLock.EnterAsync(); } public virtual ValueTask OnNextAsync(IEventSubscription subscription, ParsedEvents @event)