Skip to content

Commit

Permalink
Increase the timeout for confirmation to 10s (#325)
Browse files Browse the repository at this point in the history
* Increase the timeout for publish confirmation to 10s
* 3s was too aggressive.
----
Signed-off-by: Gabriele Santomaggio <[email protected]>
  • Loading branch information
Gsantomaggio authored Oct 30, 2023
1 parent cd46117 commit 90a6752
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion RabbitMQ.Stream.Client/Reliable/Producer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public record SuperStreamConfig

public record ProducerConfig : ReliableConfig
{
private readonly TimeSpan _timeoutMessageAfter = TimeSpan.FromSeconds(3);
private readonly TimeSpan _timeoutMessageAfter = TimeSpan.FromSeconds(10);

/// <summary>
/// Reference used for deduplication.
Expand Down
4 changes: 2 additions & 2 deletions Tests/ClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ await client.Publish(new Publish(publisherId,

Assert.Equal(10, messageCount);
await client.Unsubscribe(subId);
// await client.Close("done");
await client.Close("done");
}

[Fact]
Expand Down Expand Up @@ -422,6 +422,6 @@ public async void ExchangeVersionCommandsShouldNotBeEmpty()
Assert.Equal(ResponseCode.Ok, response.ResponseCode);
Assert.True(response.Commands.Count > 0);
await client.Close("done");
}
}
}
}
6 changes: 3 additions & 3 deletions Tests/MultiThreadTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public async Task PublishMessagesInMultiThreads()
Assert.Equal(TotalMessages * ThreadNumber, confirmed);
Assert.Equal(TotalMessages * ThreadNumber, receivedTask.Task.Result);
Assert.Equal(0, error);
await system.DeleteStream(stream);
await producer.Close().ConfigureAwait(false);
await SystemUtils.CleanUpStreamSystem(system, stream);
}

[Fact]
Expand Down Expand Up @@ -128,7 +129,6 @@ public async Task CloseProducersConsumersInMultiThreads()

SystemUtils.WaitUntil(() => consumers.TrueForAll(c => !c.IsOpen()));
Assert.All(consumers, c => Assert.False(c.IsOpen()));
await system.DeleteStream(stream);
await system.Close();
await SystemUtils.CleanUpStreamSystem(system, stream);
}
}
1 change: 1 addition & 0 deletions Tests/ReliableTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public async void SendMessageAfterKillConnectionShouldContinueToWork()
new ProducerConfig(system, stream)
{
ClientProvidedName = clientProvidedName,
TimeoutMessageAfter = TimeSpan.FromSeconds(3),
ConfirmationHandler = _ =>
{
if (Interlocked.Increment(ref count) == 10)
Expand Down
2 changes: 1 addition & 1 deletion Tests/SuperStreamConsumerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public async void MoreConsumersNumberOfMessagesConsumedShouldBeEqualsToPublished
var system = await StreamSystem.Create(new StreamSystemConfig());
var publishToSuperStreamTask =
SystemUtils.PublishMessagesSuperStream(system, "invoices", NumberOfMessages, "", _testOutputHelper);
if (await Task.WhenAny(publishToSuperStreamTask, Task.Delay(10000)) != publishToSuperStreamTask)
if (await Task.WhenAny(publishToSuperStreamTask, Task.Delay(20000)) != publishToSuperStreamTask)
{
Assert.Fail("timeout waiting to publish messages");
}
Expand Down
1 change: 1 addition & 0 deletions Tests/SystemTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ public async void NumberOfPartitionsShouldBeAsDefinition()
Assert.Contains(SystemUtils.InvoicesStream1, partitions);
Assert.Contains(SystemUtils.InvoicesStream2, partitions);
Assert.DoesNotContain(SystemUtils.InvoicesExchange, partitions);
await system.Close().ConfigureAwait(false);
}
}
}

0 comments on commit 90a6752

Please sign in to comment.