jeanouii commented on code in PR #1628:
URL: https://github.com/apache/activemq/pull/1628#discussion_r2720386651
##########
activemq-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java:
##########
@@ -1019,15 +1016,22 @@ public void testAckOfExpired() throws Exception {
Session sendSession = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = sendSession.createProducer(destination);
- producer.setTimeToLive(500);
+ final int ttl = 500;
+ producer.setTimeToLive(ttl);
final int count = 4;
for (int i = 0; i < count; i++) {
TextMessage message = sendSession.createTextMessage("" + i);
producer.send(message);
}
// let first bunch in queue expire
- Thread.sleep(1000);
+ final long expiryTime = System.currentTimeMillis() +
TimeUnit.MILLISECONDS.toMillis(ttl * 2L);
+ assertTrue("ttl elapsed", Wait.waitFor(new Wait.Condition() {
Review Comment:
Actually this is not even needed. The waitfor is only needed at the
statistics level bellow (asserts) because before that, the sleep is perfectly
valid; the expiration is only time based.
Thanks for catching it up and the review @cshannon
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact