Skip to content

Commit

Permalink
Use 1 initial credit in test
Browse files Browse the repository at this point in the history
  • Loading branch information
acogoluegnes committed Dec 11, 2024
1 parent fbdd7f2 commit 3d6b1dc
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/test/java/com/rabbitmq/stream/impl/StreamConsumerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void consumeWithAsyncConsumerFlowControl() throws Exception {
environment.consumerBuilder().stream(stream)
.offset(OffsetSpecification.first())
.flow()
.strategy(creditWhenHalfMessagesProcessed())
.strategy(creditWhenHalfMessagesProcessed(1))
.builder();

List<MessageHandler.Context> messageContexts = synchronizedList(new ArrayList<>());
Expand Down Expand Up @@ -244,14 +244,13 @@ void asynchronousProcessingWithFlowControl() {
int messageCount = 100_000;
publishAndWaitForConfirms(cf, messageCount, stream);

ExecutorService executorService =
Executors.newFixedThreadPool(getRuntime().availableProcessors());
try {
try (ExecutorService executorService =
Executors.newFixedThreadPool(getRuntime().availableProcessors())) {
CountDownLatch latch = new CountDownLatch(messageCount);
environment.consumerBuilder().stream(stream)
.offset(OffsetSpecification.first())
.flow()
.strategy(creditWhenHalfMessagesProcessed())
.strategy(creditWhenHalfMessagesProcessed(1))
.builder()
.messageHandler(
(ctx, message) ->
Expand All @@ -262,8 +261,6 @@ void asynchronousProcessingWithFlowControl() {
}))
.build();
assertThat(latch).is(completed());
} finally {
executorService.shutdownNow();
}
}

Expand Down

0 comments on commit 3d6b1dc

Please sign in to comment.