From f6fd89e8b2bb42fad2c79638e6997c07b1da48f7 Mon Sep 17 00:00:00 2001 From: petar-m Date: Thu, 27 Jun 2024 15:47:49 +0300 Subject: [PATCH] Stabilize unit tests --- src/M.EventBrokerSlim/Internal/RetryQueue.cs | 2 +- test/M.EventBrokerSlim.Tests/RetryOverrideFromOnErrorTests.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/M.EventBrokerSlim/Internal/RetryQueue.cs b/src/M.EventBrokerSlim/Internal/RetryQueue.cs index a3106e1..5f7fb90 100644 --- a/src/M.EventBrokerSlim/Internal/RetryQueue.cs +++ b/src/M.EventBrokerSlim/Internal/RetryQueue.cs @@ -70,7 +70,7 @@ private static async Task Poll(object state) self._polling = true; self._semaphore.Release(); - await Task.Delay(TimeSpan.FromMilliseconds(50), self._cancellationToken).ConfigureAwait(false); + await Task.Delay(TimeSpan.FromMilliseconds(25), self._cancellationToken).ConfigureAwait(false); } } } diff --git a/test/M.EventBrokerSlim.Tests/RetryOverrideFromOnErrorTests.cs b/test/M.EventBrokerSlim.Tests/RetryOverrideFromOnErrorTests.cs index 2eb92a1..15b92da 100644 --- a/test/M.EventBrokerSlim.Tests/RetryOverrideFromOnErrorTests.cs +++ b/test/M.EventBrokerSlim.Tests/RetryOverrideFromOnErrorTests.cs @@ -20,11 +20,12 @@ public async Task OnError_Overrides_Handle_RetryPolicy_Delay(int maxConcurrentHa var eventBroker = scope.ServiceProvider.GetRequiredService(); var eventsTracker = scope.ServiceProvider.GetRequiredService(); + eventsTracker.ExpectedItemsCount = 2; var event1 = new TestEvent("test"); // Act await eventBroker.Publish(event1); - await eventsTracker.Wait(TimeSpan.FromSeconds(1)); + await eventsTracker.Wait(TimeSpan.FromSeconds(2)); // Assert Assert.Equal(2, eventsTracker.Items.Count);