Browse Source

Fix race condition in EventConsumerProcessor.CompleteAsync causing flaky test (#1306)

* Fix race condition in EventConsumerProcessor.CompleteAsync

Agent-Logs-Url: https://github.com/Squidex/squidex/sessions/b55e1925-e661-469b-99cb-bcf3c6ff5cfd

Co-authored-by: SebastianStehle <1236435+SebastianStehle@users.noreply.github.com>

* Replace empty using block with idiomatic using-var discard

Agent-Logs-Url: https://github.com/Squidex/squidex/sessions/6bb99aa7-f129-4ec3-939b-43b41cb22b31

Co-authored-by: SebastianStehle <1236435+SebastianStehle@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: SebastianStehle <1236435+SebastianStehle@users.noreply.github.com>
pull/1308/head
Copilot 4 months ago
committed by GitHub
parent
commit
2d2017bd84
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      backend/src/Squidex.Infrastructure/EventSourcing/Consume/EventConsumerProcessor.cs

3
backend/src/Squidex.Infrastructure/EventSourcing/Consume/EventConsumerProcessor.cs

@ -72,6 +72,9 @@ public class EventConsumerProcessor : IEventSubscriber<ParsedEvents>
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)

Loading…
Cancel
Save