apupier commented on code in PR #23180:
URL: https://github.com/apache/camel/pull/23180#discussion_r3232624949
##########
core/camel-core/src/test/java/org/apache/camel/component/seda/SedaConsumerSuspendResumeTest.java:
##########
@@ -59,16 +59,12 @@ public void testSuspendResume() throws Exception {
// mode where
// it would poll and route (there is a little slack (up till 1 sec)
// before suspension is empowered)
- await().atMost(1, TimeUnit.SECONDS)
+ // wait for queues to empty and consumer to complete its poll cycle
+ await().pollDelay(1, TimeUnit.SECONDS)
+ .atMost(5, TimeUnit.SECONDS)
.until(() -> context.getEndpoint("seda:foo",
SedaEndpoint.class).getQueue().isEmpty()
&& context.getEndpoint("seda:bar",
SedaEndpoint.class).getQueue().isEmpty());
- // even though we wait for the queues to empty, there is a race
condition where the consumer
- // may still process messages while it's being suspended due to
asynchronous message handling.
- // as a result, we need to wait a bit longer to ensure that the seda
consumer is suspended before
- // sending the next message.
- Thread.sleep(1000L);
-
Review Comment:
there is no await replacement then this thread;sleep. This could only be
worse than it currently is
##########
core/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextSuspendResumeRouteTest.java:
##########
@@ -49,15 +49,9 @@ public void testSuspendResume() throws Exception {
context.suspend();
- // even though we wait for the route to suspend, there is a race
condition where the consumer
- // may still process messages while it's being suspended due to
asynchronous message handling.
- // as a result, we need to wait a bit longer to ensure that the seda
consumer is suspended before
- // sending the next message.
- Thread.sleep(1000L);
Review Comment:
there isn't a wait condition anymore ensuring that the message is suspended
##########
core/camel-core/src/test/java/org/apache/camel/impl/TwoRouteSuspendResumeTest.java:
##########
@@ -49,16 +49,10 @@ public void testSuspendResume() throws Exception {
context.getRouteController().suspendRoute("foo");
- // need to give seda consumer thread time to idle
- await().atMost(1, TimeUnit.SECONDS).until(() -> {
- return context.getEndpoint("seda:foo",
SedaEndpoint.class).getQueue().isEmpty();
- });
-
- // even though we wait for the queues to empty, there is a race
condition where the consumer
- // may still process messages while it's being suspended due to
asynchronous message handling.
- // as a result, we need to wait a bit longer to ensure that the seda
consumer is suspended before
- // sending the next message.
- Thread.sleep(1000L);
Review Comment:
there is no await replacement then this thread;sleep. This could only be
worse than it currently is
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]