Browse Source

Test improved.

pull/352/head
Sebastian Stehle 7 years ago
parent
commit
a9663f45f5
  1. 12
      src/Squidex.Infrastructure/EventSourcing/RetrySubscription.cs
  2. 2
      tests/Squidex.Infrastructure.Tests/EventSourcing/RetrySubscriptionTests.cs

12
src/Squidex.Infrastructure/EventSourcing/RetrySubscription.cs

@ -80,10 +80,7 @@ namespace Squidex.Infrastructure.EventSourcing
if (retryWindow.CanRetryAfterFailure())
{
Task.Delay(ReconnectWaitMs, timerCts.Token).ContinueWith(t =>
{
dispatcher.DispatchAsync(Subscribe);
}).Forget();
RetryAsync().Forget();
}
else
{
@ -92,6 +89,13 @@ namespace Squidex.Infrastructure.EventSourcing
}
}
private async Task RetryAsync()
{
await Task.Delay(ReconnectWaitMs, timerCts.Token);
await dispatcher.DispatchAsync(Subscribe);
}
Task IEventSubscriber.OnEventAsync(IEventSubscription subscription, StoredEvent storedEvent)
{
return dispatcher.DispatchAsync(() => HandleEventAsync(subscription, storedEvent));

2
tests/Squidex.Infrastructure.Tests/EventSourcing/RetrySubscriptionTests.cs

@ -44,7 +44,7 @@ namespace Squidex.Infrastructure.EventSourcing
{
await OnErrorAsync(eventSubscription, new InvalidOperationException());
await Task.Delay(400);
await Task.Delay(1000);
await sut.StopAsync();

Loading…
Cancel
Save